SlideShare une entreprise Scribd logo
1  sur  108
mobile east
                                                       june 2012




advanced iOS
getting your knees wet, rather then your ankles




   PETE GOODLIFFE pete@goodliffe.net @petegoodliffe
@petegoodliffe
pete@goodliffe.net
goodliffe.blogspot.com
www.goodliffe.net




      PE TE G OODL
      PROGRAMME
                   IFFE
                R / AUTHOR / COLUMNIST / TEACHER ★ CON SCIENTIOUS CODER
me
you
this
iOS is a great platform to work on, and many developers have spend some time looking at
the platform. This talk is aimed at programmers with prior iOS experience who want to get
into iOS in more depth.

This presentation will take you from a basic level of understanding of iOS to look at
advanced topics that will make you apps more polished, better designed and, ideally, more
successful.

Abstract concepts are no use, so in this talk we'll take some existing successful commercial


                                      this
iOS applications as a case study, and see how a selection of iOS technologies and
techniques combine within it.

On the way, we'll see:
  ‣How to use Objective-C language facilities to their best advantage
  ‣How to exploit key iOS technologies to save you time and effort
  ‣iOS development idioms that will improve the quality of your code
  ‣Creating "universal" iPhone/iPad/retina applications without going mad
  ‣Successful deployment and testing strategies
iOS is a great platform to work on, and many developers have spend some time looking at
the platform. This talk is aimed at programmers with prior iOS experience who want to get
into iOS in more depth.

This presentation will take you from a basic level of understanding of iOS to look at
advanced topics that will make you apps more polished, better designed and, ideally, more
successful.

Abstract concepts are no use, so in this talk we'll take some existing successful commercial


                                      this
iOS applications as a case study, and see how a selection of iOS technologies and
techniques combine within it.

On the way, we'll see:
  ‣How to use Objective-C language facilities to their best advantage
  ‣How to exploit key iOS technologies to save you time and effort
  ‣iOS development idioms that will improve the quality of your code
  ‣Creating "universal" iPhone/iPad/retina applications without going mad
  ‣Successful deployment and testing strategies
the plan
but first...
http://www.dilbert.com/strips/comic/2012-04-02/
advanced
 what does that mean?
iPhone   objective C

101        cocoa
iPhone       objective C

101            cocoa




         ?
                           iPhone

                           201
topic #1
   user interface kung foo



 topic #2
”advanced” coding techniques



 topic #3
      getting animated



 topic #4
     audio shenanigans



 topic #5
         ninja tools
topic #1
user interface kung foo
advice case study code
user interface advice

    don’t be clever
     don’t be cute
     be idiomatic
standard iOS conventions
the “extra” conventions
cool stuff
cool stuff
pull to refresh
https://github.com/enormego/EGOTableViewPullRefresh
          https://github.com/leah/PullToRefresh
     https://github.com/shiki/STableViewController
cool stuff
(swipey) sidebar
https://github.com/Inferis/ViewDeck
http://cocoacontrols.com/platforms/ios/controls/pprevealsideviewcontroller

   http://cocoacontrols.com/platforms/ios/controls/hsimagesidebarview
ui joy is in the details
subtle shadow
No Carrier         00:49          Not Charging


UIBarButtonItem                Mahjong Score Book                    UINavigationBar



                                                                    UIScrollView




     UIView
      (parent)

                                                                   Custom UIView
No Carrier         00:49          Not Charging


                        Mahjong Score Book
Gradient
No C
     arrie
           r
               19:2
                   4

                       100%




                              ✘
No C
     arrie
           r
               19:2
                   4

                       100%




                              ✘
No C
                    arrie
                          r
                              19:2
                                  4

                                      100%



pass touches
  through




                                             ✔
No C
     arrie
           r
               19:2
                   4

                       100%
No C
     arrie
           r
               19:2
                   4

                       100%
@interface FadeView : UIView
@end
@interface FadeView : UIView
@end


@implementation FadeView

- (void) setUp
{
    self.backgroundColor = [UIColor clearColor];
    CAGradientLayer *gradientLayer = [[CAGradientLayer alloc] init];
    gradientLayer.colors = [NSArray arrayWithObjects:
                            (id)[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5].CGColor,
                            (id)[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0].CGColor,
                            nil];
    gradientLayer.startPoint = CGPointMake(0,0);
    gradientLayer.endPoint   = CGPointMake(0,1);
    gradientLayer.frame = CGRectMake(0,0,self.bounds.size.width, self.bounds.size.height);

       [self.layer insertSublayer:gradientLayer atIndex:0];
}

- (id) initWithCoder:(NSCoder *)aDecoder
{
    if ((self = [super initWithCoder:aDecoder]))
    {
        [self setUp];
    }
    return self;
}

- (id) initWithFrame:(CGRect)frame { /* ... */ }

@end
theming toolbars
toolbar background




         button background

   normal                    pressed




                           highlighted &
highlighted                pressed
- (void)viewDidLoad
{
    gridView.dataSource = self;
    gridView.delegate = self;
    [gridView reloadData];

    self.navigationItem.title = AppName;
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    navigationBar.items = [NSArray arrayWithObject:self.navigationItem];
    [self setEditing:NO animated:NO];

    if ([[UINavigationBar class] respondsToSelector:@selector(appearance)])
    {
        UIEdgeInsets insets = {6, 6, 6, 6};
        UIImage *image = [[UIImage imageNamed:@"ToolbarBlack"] resizableImageWithCapInsets:insets];
        [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
        [self styleButton:self.navigationItem.leftBarButtonItem];
        [self styleButton:self.navigationItem.rightBarButtonItem];
    }

    [super viewDidLoad];
}
- (void) setEditButtonAppearance
{
    if ([[UINavigationBar class] respondsToSelector:@selector(appearance)])
    {
        UIEdgeInsets insets = {10, 10, 10, 10};
        UIImage *navButton         = !self.editing
                                   ? [[UIImage imageNamed:@"ToolbarBlackButton"]         resizableImageWithCapInsets:insets]
                                   : [[UIImage imageNamed:@"ToolbarBlackButtonSelected"] resizableImageWithCapInsets:insets];
        UIImage *navButtonPressed = !self.editing
                                   ? [[UIImage imageNamed:@"ToolbarBlackButtonPressed"]          resizableImageWithCapInsets:insets]
                                   : [[UIImage imageNamed:@"ToolbarBlackButtonSelectedPressed"] resizableImageWithCapInsets:insets];

        [self.editButtonItem setBackgroundImage:navButton          forState:UIControlStateNormal      barMetrics:UIBarMetricsDefault];
        [self.editButtonItem setBackgroundImage:navButtonPressed   forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault];
    }

}
topic #2
”advanced” coding techniques
♪
three
PROBLEMS
AVAudioPlayer



✔  Play theme tune
✘ Fade in/out
categories
associative references
        blocks
PROBLEM#1


       a nice API
categories
(because one interface is never enough)
AVAudioPlayer *player = … ;
[player play];
[player stop];
AVAudioPlayer *player = … ;
[player play];
[player stop];

[player playWithFadeDuration:1.0];
[player stopWithFadeDuration:1.0];
@interface AVAudioPlayer
{
    …
}

- (id) initWithContentsOfURL:(NSURL*)url;

- (void) play;
- (void) stop;



@end
@interface AVAudioPlayer
{
    …
}

- (id) initWithContentsOfURL:(NSURL*)url;

-   (void)   play;
-   (void)   stop;
-   (void)   playWithFadeDuration:(float)secs;
-   (void)   stopWithFadeDuration:(float)secs;

@end
@interface AVAudioPlayer (Fades)

- (void) playWithFadeDuration:(float)secs;
- (void) stopWithFadeDuration:(float)secs;

@end
@implementation AVAudioPlayer (Fades)

- (void) playWithFadeDuration:(float)secs
{
    // magic happens here
}

- (void) stopWithFadeDuration:(float)secs
{
    // clever stuff in here
}

@end
AVAudioPlayer *player = … ;
[player play];
[player stop];

[player playWithFadeDuration:1.0];
[player stopWithFadeDuration:1.0];




                                     ✔
PROBLEM#2

    we need some new
    instance variables
associative references
    (a posh name for cheating)
static const char volumeLevelKey = ‘Q’;
NSNumber *number = [NSNumber numberWithFloat:1.0];

objc_setAssociatedObject(self,
    &volumeLevelKey,
    number,
    OBJ_ASSOCIATION_RETAIN_NONATOMIC);
NSNumber *number =
    (NSNumber*)objc_getAssociatedObject(self, &volumeLevelKey);
@interface AVAudioPlayer (Fades)

- (void) playWithFadeDuration:(float)secs;
- (void) stopWithFadeDuration:(float)secs;

@property float fadeVolume;

@end
- (void) fadeVolume
{
    // gibberish in here
}

- (void) setFadeVolume
{
    // cobblers in here
}




                                   ✔
float fadeVolume = player.fadeVolume;
PROBLEM#3

  we need to use another
  fancy language feature
blocks
(because C++ isn’t the only cool language)
PROBLEM#3

 when a fade has completed,
      do “something”
typedef void (^FadeCompleteBlock)();
typedef void (^FadeCompleteBlock)();




- (void) fadeToVolume:(float)volume
         withDuration:(float)secs
              andThen:(FadeCompleteBlock)action
typedef void (^FadeCompleteBlock)();

- (void) fadeToVolume:(float)volume
         withDuration:(float)secs
              andThen:(FadeCompleteBlock)action



[player fadeToVolume:0.0
        withDuration:1.0
             andThen:^{
                 [player stop];
                 player.volume = 1.0;
             }];
http://goodliffe.blogspot.co.uk/2011/04/ios-fading-avaudioplayer.html
   https://gitorious.org/audioplayerwithfade/audioplayerwithfade
topic #3
 getting animated
video>>>
- (void) documentsViewControllerSelected:(NSString*)file fromRect:(CGRect)from;
{
    lastDocumentRect = from;

    scoresViewController.filename = file;
    [scoresViewController animateAppearingFrom:from afterDelay:0.1];
    [window setRootViewController:scoresViewController animated:YES];
}
- (void) animateAppearingFrom:(CGRect)rect afterDelay:(NSTimeInterval)delay
{
    (void)self.view;

    UIImage     *image     = [mainView drawIntoImage];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

    [mainView.superview addSubview:imageView];
    imageView.frame = rect;
    mainView.hidden = YES;

    [UIView animateWithDuration:1.0
                           delay:delay
                         options:UIViewAnimationOptionAllowUserInteraction
                     animations:^{
                          imageView.frame = mainView.frame;
                     }
                     completion:^(BOOL finished){
                          mainView.hidden = NO;
                          [imageView removeFromSuperview];
                     }];
}
@interface UIView (PGLib)
- (UIImage*) drawIntoImage;
@end




- (UIImage*) drawIntoImage
{
    UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque,
                                           [[UIScreen mainScreen] scale]);
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
- (void) animateAppearingFrom:(CGRect)rect afterDelay:(NSTimeInterval)delay
{
    (void)self.view;

    UIImage     *image     = [mainView drawIntoImage];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

    [mainView.superview addSubview:imageView];
    imageView.frame = rect;
    mainView.hidden = YES;

    [UIView animateWithDuration:1.0
                           delay:delay
                         options:UIViewAnimationOptionAllowUserInteraction
                     animations:^{
                          imageView.frame = mainView.frame;
                     }
                     completion:^(BOOL finished){
                          mainView.hidden = NO;
                          [imageView removeFromSuperview];
                     }];
}
@interface TitlePageView : UIView
{
    CAShapeLayer *shapeLayer1;
    CAShapeLayer *shapeLayer2;
    CAShapeLayer *shapeLayer3;
    CALayer      *imageLayer;
}

@property (nonatomic, retain) IBOutlet UIButton *playButton;

-   (void)   startAnimation;
-   (void)   checkAnimationsRunning;
-   (void)   stopAnimation;
-   (void)   setBackgroundImage:(UIImage*)backgroundImage;

@end
-(void) startAnimation
{
	 CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];

	   animation.duration          = 5.0;
	   animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
	   animation.repeatCount       = 10000;
	   animation.autoreverses      = YES;
	   animation.fromValue         = [NSNumber numberWithDouble:0];
	   animation.toValue           = [NSNumber numberWithDouble:M_PI];
	   [shapeLayer1 addAnimation:animation forKey:@"animatePath"];

	   animation.duration          = 8.0;
	   [shapeLayer2 addAnimation:animation forKey:@"animatePath"];

	   animation.duration          = 13.0;
	   [shapeLayer3 addAnimation:animation forKey:@"animatePath"];
}

-(void) stopAnimation
{
    [shapeLayer1 removeAllAnimations];
    [shapeLayer2 removeAllAnimations];
    [shapeLayer3 removeAllAnimations];
}
topic #4
 audio shenanigans
you have a phone
 it makes a noise
   how do you do that?
CoreAudio

                                      Audio




            } {
                                     Services


                                     OpenAL        Headphones



                                   AVAudioPlayer    Speaker
Your code                 Audio
                         Session
                                      Audio           USB
                                      Queue

                                      Audio
                                       Unit         Bluetooth



            Audio File
             Services
Audio Session                                      Services




                                                              }                              {
                                                                             OpenAL              Phones

                                                                             AVAudioPlayer
                                                                                                 Speaker
                                                       Code       Session

                                                                              Queue               USB

                                                                                Unit               BT




                                              Phone Call



         Describe type
 App                         Doing my
         of audio use &                     INTERRUPTION!                   Resume
starts                      audio thing
          start session




                               Other apps
Audio Services                                                      Services




                                                                                         }                             {
                                                                                                       OpenAL              Phones

                                                                                                       AVAudioPlayer
                                                                                                                           Speaker
                                                                                  Code       Session

                                                                                                        Queue               USB

                                                                                                          Unit               BT
@interface Sounds : NSObject
{
     SystemSoundID lock;
}
- (void) lock;
@end



                               @implementation Sounds

                               - (id)init
                               {
                                   if ((self = [super init]))
                                   {
                                       NSBundle *bundle = [NSBundle mainBundle];
                                       NSURL    *lockUrl = [bundle URLForResource:@"Noise" withExtension:@"wav"];
                                       AudioServicesCreateSystemSoundID((__bridge CFURLRef)lockUrl, &lock);
                                   }

                                      return self;
                               }

                               - (void) lock
                               {
                                   AudioServicesPlayAlertSound(lock);
                               }

                               @end
OpenAL                                             Services




                                                               }                             {
                                                                             OpenAL              Phones

                                                                             AVAudioPlayer
                                                                                                 Speaker
                                                        Code       Session

                                                                              Queue               USB

                                                                                Unit               BT




  OpenAL is a cross-platform 3D audio API appropriate for use with
  gaming applications and many other types of audio applications.

   The library models a collection of audio sources moving in a 3D
 space that are heard by a single listener somewhere in that space.
The basic OpenAL objects are a Listener, a Source, and a Buffer. There
  can be a large number of Buffers, which contain audio data. Each
  buffer can be attached to one or more Sources, which represent
  points in 3D space which are emitting audio. There is always one
  Listener object (per audio context), which represents the position
      where the sources are heard -- rendering is done from the
                      perspective of the Listener.
AVAudioPlayer                                  Services




                                        }                             {
                                                      OpenAL              Phones

                                                      AVAudioPlayer
                                                                          Speaker
                                 Code       Session

                                                       Queue               USB

                                                         Unit               BT




“Apple recommends that you use
this class for audio playback unless




                                ”
   you are playing audio captured
 from a network stream or require
        very low I/O latency.
AVAudioPlayer                              Services




                             }                             {
                                           OpenAL              Phones

                                           AVAudioPlayer
                                                               Speaker
                      Code       Session

                                            Queue               USB

                                              Unit               BT




play single sound
    (memory or file)

      seek
  control level
   read level
Services




                                       }                             {
                                                     OpenAL              Phones

                                                     AVAudioPlayer
                                                                         Speaker
                                Code       Session

                                                      Queue               USB

                                                        Unit               BT




 Audio                     Audio
 Queue                      Unit
low latency            lowest latency
                           plug-in
                         architecture
dealing with plain old PCM audio data
topic #5
  ninja tools
#pragma mark
     . . .
             }
                 afterDelay:0.5];
    }
    return imported >= 0;
}

//==============================================================================
#pragma mark - IBActions

- (IBAction)add:(id)sender
{
    [self hideTipView];
    unsigned index = [documents addNewGame];
    [gridView
    . . .




     . . .
     [popup presentFromRect:popupRect inView:gridView.superview
                                    withText:view.name
                                  withObject:[NSNumber numberWithUnsignedInt:[gridView indexForCell:cell]]];
}

#pragma mark UIActionSheetDelegate

- (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    sheet = 0;

     if (buttonIndex != 0) return;
    . . .
TestFlight
(don’t reinvent)
http://cocoacontrols.com/
http://www.stackoverflow.com/
    http://www.github.com/
QA
                  ★★★




                    &
                  ★★★


Pete Goodliffe @petegoodliffe pete@goodliffe.net
@petegoodliffe
pete@goodliffe.net
goodliffe.blogspot.com
www.goodliffe.net
BUMPH DULL, but important                            ★

THIS DOCUMENT WAS CREATED BY PETE GOODLIFFE
    IT IS COPYRIGHT // © 2012 PETE GOODLIFFE
>> ALL RIGHTS RESERVED
>> ALL THOUGHTS ARE OWNED
>> PHOTOS AND IMAGES ARE MOSTLY
    SOURCED FROM THE WEB
THANK YOU FOR READING // I HOPE IT WAS USEFUL
                                      Version 1.0 2012-08-14

Contenu connexe

En vedette

iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework Eakapong Kattiya
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective cSunny Shaikh
 
Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015Somkiat Khitwongwattana
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 
Introduction to xcode
Introduction to xcodeIntroduction to xcode
Introduction to xcodeSunny Shaikh
 
Deep dive into android restoration - DroidCon Paris 2014
Deep dive into android restoration - DroidCon Paris 2014Deep dive into android restoration - DroidCon Paris 2014
Deep dive into android restoration - DroidCon Paris 2014Paris Android User Group
 
Web Services with Objective-C
Web Services with Objective-CWeb Services with Objective-C
Web Services with Objective-CJuio Barros
 
iOS Development - A Beginner Guide
iOS Development - A Beginner GuideiOS Development - A Beginner Guide
iOS Development - A Beginner GuideAndri Yadi
 
Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - CJussi Pohjolainen
 
Apple iOS Introduction
Apple iOS IntroductionApple iOS Introduction
Apple iOS IntroductionPratik Vyas
 
Prenetics InsurTech Award Presentation
Prenetics InsurTech Award PresentationPrenetics InsurTech Award Presentation
Prenetics InsurTech Award PresentationThe Digital Insurer
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CDataArt
 

En vedette (19)

iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
iOS Basic Development Day 2 - Objective-C 2.0 & iOS Framework
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
iOS Basic
iOS BasiciOS Basic
iOS Basic
 
Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015Smart Lock for Password @ Game DevFest Bangkok 2015
Smart Lock for Password @ Game DevFest Bangkok 2015
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
Introduction to xcode
Introduction to xcodeIntroduction to xcode
Introduction to xcode
 
iOS
iOSiOS
iOS
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
Deep dive into android restoration - DroidCon Paris 2014
Deep dive into android restoration - DroidCon Paris 2014Deep dive into android restoration - DroidCon Paris 2014
Deep dive into android restoration - DroidCon Paris 2014
 
Web Services with Objective-C
Web Services with Objective-CWeb Services with Objective-C
Web Services with Objective-C
 
Advance Android Layout Walkthrough
Advance Android Layout WalkthroughAdvance Android Layout Walkthrough
Advance Android Layout Walkthrough
 
iOS Development - A Beginner Guide
iOS Development - A Beginner GuideiOS Development - A Beginner Guide
iOS Development - A Beginner Guide
 
Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - C
 
Apple iOS Introduction
Apple iOS IntroductionApple iOS Introduction
Apple iOS Introduction
 
Ios operating system
Ios operating systemIos operating system
Ios operating system
 
200810 - iPhone Tutorial
200810 - iPhone Tutorial200810 - iPhone Tutorial
200810 - iPhone Tutorial
 
Prenetics InsurTech Award Presentation
Prenetics InsurTech Award PresentationPrenetics InsurTech Award Presentation
Prenetics InsurTech Award Presentation
 
Apple iOS
Apple iOSApple iOS
Apple iOS
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
 

Similaire à Advanced iOS

Style vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSStyle vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSKeith Norman
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material DesignYasin Yildirim
 
IBDesignable - CocoaConf Seattle 2014
IBDesignable - CocoaConf Seattle 2014IBDesignable - CocoaConf Seattle 2014
IBDesignable - CocoaConf Seattle 2014Martin Nash
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsClay Ewing
 
用 IBDesignable 作 UI
用 IBDesignable 作 UI用 IBDesignable 作 UI
用 IBDesignable 作 UITsungyu Yu
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
RubyMotion
RubyMotionRubyMotion
RubyMotionMark
 
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil Tayar
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil TayarVisual Testing: The Missing Piece of the Puzzle -- presentation by Gil Tayar
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil TayarApplitools
 
MNT2014: Mobile Hibrido com Phonegap
MNT2014: Mobile Hibrido com PhonegapMNT2014: Mobile Hibrido com Phonegap
MNT2014: Mobile Hibrido com PhonegapLoiane Groner
 
Creating a flawless user experience, end to-end, functional to visual - Slide...
Creating a flawless user experience, end to-end, functional to visual - Slide...Creating a flawless user experience, end to-end, functional to visual - Slide...
Creating a flawless user experience, end to-end, functional to visual - Slide...Applitools
 
Building a Native Camera Access Library - Part I - Transcript.pdf
Building a Native Camera Access Library - Part I - Transcript.pdfBuilding a Native Camera Access Library - Part I - Transcript.pdf
Building a Native Camera Access Library - Part I - Transcript.pdfShaiAlmog1
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make itJonathan Snook
 
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ....NET Conf UY
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads France
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Developmentandriajensen
 
Developing AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalDeveloping AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalChris Griffith
 
iOSインタラクションデザイン
iOSインタラクションデザインiOSインタラクションデザイン
iOSインタラクションデザインhIDDENxv
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)Bramus Van Damme
 

Similaire à Advanced iOS (20)

Style vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOSStyle vs. Content and Clean Theming in iOS
Style vs. Content and Clean Theming in iOS
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Getting Started With Material Design
Getting Started With Material DesignGetting Started With Material Design
Getting Started With Material Design
 
IBDesignable - CocoaConf Seattle 2014
IBDesignable - CocoaConf Seattle 2014IBDesignable - CocoaConf Seattle 2014
IBDesignable - CocoaConf Seattle 2014
 
Cordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web SkillsCordova: Making Native Mobile Apps With Your Web Skills
Cordova: Making Native Mobile Apps With Your Web Skills
 
用 IBDesignable 作 UI
用 IBDesignable 作 UI用 IBDesignable 作 UI
用 IBDesignable 作 UI
 
Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
RubyMotion
RubyMotionRubyMotion
RubyMotion
 
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil Tayar
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil TayarVisual Testing: The Missing Piece of the Puzzle -- presentation by Gil Tayar
Visual Testing: The Missing Piece of the Puzzle -- presentation by Gil Tayar
 
MNT2014: Mobile Hibrido com Phonegap
MNT2014: Mobile Hibrido com PhonegapMNT2014: Mobile Hibrido com Phonegap
MNT2014: Mobile Hibrido com Phonegap
 
Pc54
Pc54Pc54
Pc54
 
Creating a flawless user experience, end to-end, functional to visual - Slide...
Creating a flawless user experience, end to-end, functional to visual - Slide...Creating a flawless user experience, end to-end, functional to visual - Slide...
Creating a flawless user experience, end to-end, functional to visual - Slide...
 
Building a Native Camera Access Library - Part I - Transcript.pdf
Building a Native Camera Access Library - Part I - Transcript.pdfBuilding a Native Camera Access Library - Part I - Transcript.pdf
Building a Native Camera Access Library - Part I - Transcript.pdf
 
Fake it 'til you make it
Fake it 'til you make itFake it 'til you make it
Fake it 'til you make it
 
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIView
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
 
Developing AIR for Android with Flash Professional
Developing AIR for Android with Flash ProfessionalDeveloping AIR for Android with Flash Professional
Developing AIR for Android with Flash Professional
 
iOSインタラクションデザイン
iOSインタラクションデザインiOSインタラクションデザイン
iOSインタラクションデザイン
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 

Plus de Pete Goodliffe

Becoming a Better Programmer
Becoming a Better ProgrammerBecoming a Better Programmer
Becoming a Better ProgrammerPete Goodliffe
 
Running Effective Worship Rehearsals
Running Effective Worship RehearsalsRunning Effective Worship Rehearsals
Running Effective Worship RehearsalsPete Goodliffe
 
Becoming a Better Programmer (2013)
Becoming a Better Programmer (2013)Becoming a Better Programmer (2013)
Becoming a Better Programmer (2013)Pete Goodliffe
 
Version Control Done Right
Version Control Done RightVersion Control Done Right
Version Control Done RightPete Goodliffe
 
C++: The Cathedral and the Bizarre
C++: The Cathedral and the BizarreC++: The Cathedral and the Bizarre
C++: The Cathedral and the BizarrePete Goodliffe
 
iOS Development (BCS Newcastle)
iOS Development (BCS Newcastle)iOS Development (BCS Newcastle)
iOS Development (BCS Newcastle)Pete Goodliffe
 
Three Objectionable Things
Three Objectionable ThingsThree Objectionable Things
Three Objectionable ThingsPete Goodliffe
 
Coping with Complexity
Coping with ComplexityCoping with Complexity
Coping with ComplexityPete Goodliffe
 
iOS Development (BCS Edinburgh 2011-03-09)
iOS Development (BCS Edinburgh 2011-03-09)iOS Development (BCS Edinburgh 2011-03-09)
iOS Development (BCS Edinburgh 2011-03-09)Pete Goodliffe
 
Stood at the bottom of a mountain looking up
Stood at the bottom of a mountain looking upStood at the bottom of a mountain looking up
Stood at the bottom of a mountain looking upPete Goodliffe
 
iPhone development: A brief introduction
iPhone development: A brief introductioniPhone development: A brief introduction
iPhone development: A brief introductionPete Goodliffe
 
Legacy Code: Learning To Live With It
Legacy Code: Learning To Live With ItLegacy Code: Learning To Live With It
Legacy Code: Learning To Live With ItPete Goodliffe
 

Plus de Pete Goodliffe (16)

Becoming a Better Programmer
Becoming a Better ProgrammerBecoming a Better Programmer
Becoming a Better Programmer
 
Words in Code
Words in CodeWords in Code
Words in Code
 
Running Effective Worship Rehearsals
Running Effective Worship RehearsalsRunning Effective Worship Rehearsals
Running Effective Worship Rehearsals
 
Becoming a Better Programmer (2013)
Becoming a Better Programmer (2013)Becoming a Better Programmer (2013)
Becoming a Better Programmer (2013)
 
Design Sins
Design SinsDesign Sins
Design Sins
 
Version Control Done Right
Version Control Done RightVersion Control Done Right
Version Control Done Right
 
Getting Into Git
Getting Into GitGetting Into Git
Getting Into Git
 
C++: The Cathedral and the Bizarre
C++: The Cathedral and the BizarreC++: The Cathedral and the Bizarre
C++: The Cathedral and the Bizarre
 
iOS Development (BCS Newcastle)
iOS Development (BCS Newcastle)iOS Development (BCS Newcastle)
iOS Development (BCS Newcastle)
 
Three Objectionable Things
Three Objectionable ThingsThree Objectionable Things
Three Objectionable Things
 
Coping with Complexity
Coping with ComplexityCoping with Complexity
Coping with Complexity
 
Manyfestos
ManyfestosManyfestos
Manyfestos
 
iOS Development (BCS Edinburgh 2011-03-09)
iOS Development (BCS Edinburgh 2011-03-09)iOS Development (BCS Edinburgh 2011-03-09)
iOS Development (BCS Edinburgh 2011-03-09)
 
Stood at the bottom of a mountain looking up
Stood at the bottom of a mountain looking upStood at the bottom of a mountain looking up
Stood at the bottom of a mountain looking up
 
iPhone development: A brief introduction
iPhone development: A brief introductioniPhone development: A brief introduction
iPhone development: A brief introduction
 
Legacy Code: Learning To Live With It
Legacy Code: Learning To Live With ItLegacy Code: Learning To Live With It
Legacy Code: Learning To Live With It
 

Dernier

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 

Dernier (20)

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 

Advanced iOS

  • 1. mobile east june 2012 advanced iOS getting your knees wet, rather then your ankles PETE GOODLIFFE pete@goodliffe.net @petegoodliffe
  • 2. @petegoodliffe pete@goodliffe.net goodliffe.blogspot.com www.goodliffe.net PE TE G OODL PROGRAMME IFFE R / AUTHOR / COLUMNIST / TEACHER ★ CON SCIENTIOUS CODER
  • 3.
  • 4. me
  • 5. you
  • 7. iOS is a great platform to work on, and many developers have spend some time looking at the platform. This talk is aimed at programmers with prior iOS experience who want to get into iOS in more depth. This presentation will take you from a basic level of understanding of iOS to look at advanced topics that will make you apps more polished, better designed and, ideally, more successful. Abstract concepts are no use, so in this talk we'll take some existing successful commercial this iOS applications as a case study, and see how a selection of iOS technologies and techniques combine within it. On the way, we'll see: ‣How to use Objective-C language facilities to their best advantage ‣How to exploit key iOS technologies to save you time and effort ‣iOS development idioms that will improve the quality of your code ‣Creating "universal" iPhone/iPad/retina applications without going mad ‣Successful deployment and testing strategies
  • 8. iOS is a great platform to work on, and many developers have spend some time looking at the platform. This talk is aimed at programmers with prior iOS experience who want to get into iOS in more depth. This presentation will take you from a basic level of understanding of iOS to look at advanced topics that will make you apps more polished, better designed and, ideally, more successful. Abstract concepts are no use, so in this talk we'll take some existing successful commercial this iOS applications as a case study, and see how a selection of iOS technologies and techniques combine within it. On the way, we'll see: ‣How to use Objective-C language facilities to their best advantage ‣How to exploit key iOS technologies to save you time and effort ‣iOS development idioms that will improve the quality of your code ‣Creating "universal" iPhone/iPad/retina applications without going mad ‣Successful deployment and testing strategies
  • 12.
  • 13. advanced what does that mean?
  • 14. iPhone objective C 101 cocoa
  • 15. iPhone objective C 101 cocoa ? iPhone 201
  • 16. topic #1 user interface kung foo topic #2 ”advanced” coding techniques topic #3 getting animated topic #4 audio shenanigans topic #5 ninja tools
  • 19. user interface advice don’t be clever don’t be cute be idiomatic
  • 24.
  • 26. https://github.com/enormego/EGOTableViewPullRefresh https://github.com/leah/PullToRefresh https://github.com/shiki/STableViewController
  • 28.
  • 29.
  • 30.
  • 32.
  • 34. ui joy is in the details
  • 35.
  • 36.
  • 37.
  • 38.
  • 40. No Carrier 00:49 Not Charging UIBarButtonItem Mahjong Score Book UINavigationBar UIScrollView UIView (parent) Custom UIView
  • 41. No Carrier 00:49 Not Charging Mahjong Score Book Gradient
  • 42. No C arrie r 19:2 4 100% ✘
  • 43. No C arrie r 19:2 4 100% ✘
  • 44. No C arrie r 19:2 4 100% pass touches through ✔
  • 45. No C arrie r 19:2 4 100%
  • 46. No C arrie r 19:2 4 100%
  • 47. @interface FadeView : UIView @end
  • 48. @interface FadeView : UIView @end @implementation FadeView - (void) setUp { self.backgroundColor = [UIColor clearColor]; CAGradientLayer *gradientLayer = [[CAGradientLayer alloc] init]; gradientLayer.colors = [NSArray arrayWithObjects: (id)[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5].CGColor, (id)[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0].CGColor, nil]; gradientLayer.startPoint = CGPointMake(0,0); gradientLayer.endPoint = CGPointMake(0,1); gradientLayer.frame = CGRectMake(0,0,self.bounds.size.width, self.bounds.size.height); [self.layer insertSublayer:gradientLayer atIndex:0]; } - (id) initWithCoder:(NSCoder *)aDecoder { if ((self = [super initWithCoder:aDecoder])) { [self setUp]; } return self; } - (id) initWithFrame:(CGRect)frame { /* ... */ } @end
  • 50. toolbar background button background normal pressed highlighted & highlighted pressed
  • 51. - (void)viewDidLoad { gridView.dataSource = self; gridView.delegate = self; [gridView reloadData]; self.navigationItem.title = AppName; self.navigationItem.rightBarButtonItem = self.editButtonItem; navigationBar.items = [NSArray arrayWithObject:self.navigationItem]; [self setEditing:NO animated:NO]; if ([[UINavigationBar class] respondsToSelector:@selector(appearance)]) { UIEdgeInsets insets = {6, 6, 6, 6}; UIImage *image = [[UIImage imageNamed:@"ToolbarBlack"] resizableImageWithCapInsets:insets]; [self.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; [self styleButton:self.navigationItem.leftBarButtonItem]; [self styleButton:self.navigationItem.rightBarButtonItem]; } [super viewDidLoad]; }
  • 52. - (void) setEditButtonAppearance { if ([[UINavigationBar class] respondsToSelector:@selector(appearance)]) { UIEdgeInsets insets = {10, 10, 10, 10}; UIImage *navButton = !self.editing ? [[UIImage imageNamed:@"ToolbarBlackButton"] resizableImageWithCapInsets:insets] : [[UIImage imageNamed:@"ToolbarBlackButtonSelected"] resizableImageWithCapInsets:insets]; UIImage *navButtonPressed = !self.editing ? [[UIImage imageNamed:@"ToolbarBlackButtonPressed"] resizableImageWithCapInsets:insets] : [[UIImage imageNamed:@"ToolbarBlackButtonSelectedPressed"] resizableImageWithCapInsets:insets]; [self.editButtonItem setBackgroundImage:navButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [self.editButtonItem setBackgroundImage:navButtonPressed forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; } }
  • 54.
  • 56. AVAudioPlayer ✔ Play theme tune ✘ Fade in/out
  • 58. PROBLEM#1 a nice API
  • 60. AVAudioPlayer *player = … ; [player play]; [player stop];
  • 61. AVAudioPlayer *player = … ; [player play]; [player stop]; [player playWithFadeDuration:1.0]; [player stopWithFadeDuration:1.0];
  • 62. @interface AVAudioPlayer { … } - (id) initWithContentsOfURL:(NSURL*)url; - (void) play; - (void) stop; @end
  • 63. @interface AVAudioPlayer { … } - (id) initWithContentsOfURL:(NSURL*)url; - (void) play; - (void) stop; - (void) playWithFadeDuration:(float)secs; - (void) stopWithFadeDuration:(float)secs; @end
  • 64. @interface AVAudioPlayer (Fades) - (void) playWithFadeDuration:(float)secs; - (void) stopWithFadeDuration:(float)secs; @end
  • 65. @implementation AVAudioPlayer (Fades) - (void) playWithFadeDuration:(float)secs { // magic happens here } - (void) stopWithFadeDuration:(float)secs { // clever stuff in here } @end
  • 66. AVAudioPlayer *player = … ; [player play]; [player stop]; [player playWithFadeDuration:1.0]; [player stopWithFadeDuration:1.0]; ✔
  • 67. PROBLEM#2 we need some new instance variables
  • 68. associative references (a posh name for cheating)
  • 69. static const char volumeLevelKey = ‘Q’; NSNumber *number = [NSNumber numberWithFloat:1.0]; objc_setAssociatedObject(self, &volumeLevelKey, number, OBJ_ASSOCIATION_RETAIN_NONATOMIC);
  • 70. NSNumber *number = (NSNumber*)objc_getAssociatedObject(self, &volumeLevelKey);
  • 71. @interface AVAudioPlayer (Fades) - (void) playWithFadeDuration:(float)secs; - (void) stopWithFadeDuration:(float)secs; @property float fadeVolume; @end
  • 72. - (void) fadeVolume { // gibberish in here } - (void) setFadeVolume { // cobblers in here } ✔ float fadeVolume = player.fadeVolume;
  • 73. PROBLEM#3 we need to use another fancy language feature
  • 74. blocks (because C++ isn’t the only cool language)
  • 75. PROBLEM#3 when a fade has completed, do “something”
  • 77. typedef void (^FadeCompleteBlock)(); - (void) fadeToVolume:(float)volume withDuration:(float)secs andThen:(FadeCompleteBlock)action
  • 78. typedef void (^FadeCompleteBlock)(); - (void) fadeToVolume:(float)volume withDuration:(float)secs andThen:(FadeCompleteBlock)action [player fadeToVolume:0.0 withDuration:1.0 andThen:^{ [player stop]; player.volume = 1.0; }];
  • 79. http://goodliffe.blogspot.co.uk/2011/04/ios-fading-avaudioplayer.html https://gitorious.org/audioplayerwithfade/audioplayerwithfade
  • 80. topic #3 getting animated
  • 82.
  • 83. - (void) documentsViewControllerSelected:(NSString*)file fromRect:(CGRect)from; { lastDocumentRect = from; scoresViewController.filename = file; [scoresViewController animateAppearingFrom:from afterDelay:0.1]; [window setRootViewController:scoresViewController animated:YES]; }
  • 84. - (void) animateAppearingFrom:(CGRect)rect afterDelay:(NSTimeInterval)delay { (void)self.view; UIImage *image = [mainView drawIntoImage]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [mainView.superview addSubview:imageView]; imageView.frame = rect; mainView.hidden = YES; [UIView animateWithDuration:1.0 delay:delay options:UIViewAnimationOptionAllowUserInteraction animations:^{ imageView.frame = mainView.frame; } completion:^(BOOL finished){ mainView.hidden = NO; [imageView removeFromSuperview]; }]; }
  • 85. @interface UIView (PGLib) - (UIImage*) drawIntoImage; @end - (UIImage*) drawIntoImage { UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, [[UIScreen mainScreen] scale]); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }
  • 86. - (void) animateAppearingFrom:(CGRect)rect afterDelay:(NSTimeInterval)delay { (void)self.view; UIImage *image = [mainView drawIntoImage]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [mainView.superview addSubview:imageView]; imageView.frame = rect; mainView.hidden = YES; [UIView animateWithDuration:1.0 delay:delay options:UIViewAnimationOptionAllowUserInteraction animations:^{ imageView.frame = mainView.frame; } completion:^(BOOL finished){ mainView.hidden = NO; [imageView removeFromSuperview]; }]; }
  • 87.
  • 88.
  • 89. @interface TitlePageView : UIView { CAShapeLayer *shapeLayer1; CAShapeLayer *shapeLayer2; CAShapeLayer *shapeLayer3; CALayer *imageLayer; } @property (nonatomic, retain) IBOutlet UIButton *playButton; - (void) startAnimation; - (void) checkAnimationsRunning; - (void) stopAnimation; - (void) setBackgroundImage:(UIImage*)backgroundImage; @end
  • 90. -(void) startAnimation { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 5.0; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; animation.repeatCount = 10000; animation.autoreverses = YES; animation.fromValue = [NSNumber numberWithDouble:0]; animation.toValue = [NSNumber numberWithDouble:M_PI]; [shapeLayer1 addAnimation:animation forKey:@"animatePath"]; animation.duration = 8.0; [shapeLayer2 addAnimation:animation forKey:@"animatePath"]; animation.duration = 13.0; [shapeLayer3 addAnimation:animation forKey:@"animatePath"]; } -(void) stopAnimation { [shapeLayer1 removeAllAnimations]; [shapeLayer2 removeAllAnimations]; [shapeLayer3 removeAllAnimations]; }
  • 91. topic #4 audio shenanigans
  • 92. you have a phone it makes a noise how do you do that?
  • 93. CoreAudio Audio } { Services OpenAL Headphones AVAudioPlayer Speaker Your code Audio Session Audio USB Queue Audio Unit Bluetooth Audio File Services
  • 94. Audio Session Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT Phone Call Describe type App Doing my of audio use & INTERRUPTION! Resume starts audio thing start session Other apps
  • 95. Audio Services Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT @interface Sounds : NSObject { SystemSoundID lock; } - (void) lock; @end @implementation Sounds - (id)init { if ((self = [super init])) { NSBundle *bundle = [NSBundle mainBundle]; NSURL *lockUrl = [bundle URLForResource:@"Noise" withExtension:@"wav"]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)lockUrl, &lock); } return self; } - (void) lock { AudioServicesPlayAlertSound(lock); } @end
  • 96. OpenAL Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT OpenAL is a cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications. The library models a collection of audio sources moving in a 3D space that are heard by a single listener somewhere in that space. The basic OpenAL objects are a Listener, a Source, and a Buffer. There can be a large number of Buffers, which contain audio data. Each buffer can be attached to one or more Sources, which represent points in 3D space which are emitting audio. There is always one Listener object (per audio context), which represents the position where the sources are heard -- rendering is done from the perspective of the Listener.
  • 97. AVAudioPlayer Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT “Apple recommends that you use this class for audio playback unless ” you are playing audio captured from a network stream or require very low I/O latency.
  • 98. AVAudioPlayer Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT play single sound (memory or file) seek control level read level
  • 99. Services } { OpenAL Phones AVAudioPlayer Speaker Code Session Queue USB Unit BT Audio Audio Queue Unit low latency lowest latency plug-in architecture dealing with plain old PCM audio data
  • 100. topic #5 ninja tools
  • 101. #pragma mark . . . } afterDelay:0.5]; } return imported >= 0; } //============================================================================== #pragma mark - IBActions - (IBAction)add:(id)sender { [self hideTipView]; unsigned index = [documents addNewGame]; [gridView . . . . . . [popup presentFromRect:popupRect inView:gridView.superview withText:view.name withObject:[NSNumber numberWithUnsignedInt:[gridView indexForCell:cell]]]; } #pragma mark UIActionSheetDelegate - (void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { sheet = 0; if (buttonIndex != 0) return; . . .
  • 103.
  • 106. QA ★★★ & ★★★ Pete Goodliffe @petegoodliffe pete@goodliffe.net
  • 108. BUMPH DULL, but important ★ THIS DOCUMENT WAS CREATED BY PETE GOODLIFFE IT IS COPYRIGHT // © 2012 PETE GOODLIFFE >> ALL RIGHTS RESERVED >> ALL THOUGHTS ARE OWNED >> PHOTOS AND IMAGES ARE MOSTLY SOURCED FROM THE WEB THANK YOU FOR READING // I HOPE IT WAS USEFUL Version 1.0 2012-08-14