SlideShare ist ein Scribd-Unternehmen logo
1 von 229
iOS 5
iOS 5
• About Me:
 • Pat Zearfoss
 • Mindgrub Technologies, LLC
 • BS Computer Science - UMBC 2008
 • Working with mobile and iOS for 4
   years.
iOS 5

• Web:
    pzearfoss@gmail.com
    http://zearfoss.wordpress.com
    @pzearfoss
    http://www.github.com/pzearfoss
Where we’re going:
Where we’re going:

• Quick Objective-c and iOS review
Where we’re going:

• Quick Objective-c and iOS review
• Overview of iOS 5 additions and changes
Where we’re going:

• Quick Objective-c and iOS review
• Overview of iOS 5 additions and changes
• Introducing Lobstagram
Where we’re going:

• Quick Objective-c and iOS review
• Overview of iOS 5 additions and changes
• Introducing Lobstagram
• Other iOS 5 features (as time permits)
About iOS Development
About iOS Development


• Objective-c only
About iOS Development


• Objective-c only
 • Other tools are getting better:
About iOS Development


• Objective-c only
 • Other tools are getting better:
 • Titanium, PhoneGap, MonoTouch
About iOS Development


• Objective-c only
 • Other tools are getting better:
 • Titanium, PhoneGap, MonoTouch
• Mac required
About iOS Development


• Objective-c only
 • Other tools are getting better:
 • Titanium, PhoneGap, MonoTouch
• Mac required
• Xcode required (free!)
Xcode
• Download from App Store
Objective-c crash
    course
Getting Started
Getting Started

• Things you should know
Getting Started

• Things you should know
 • Classical OO
Getting Started

• Things you should know
 • Classical OO
   • Classes
Getting Started

• Things you should know
 • Classical OO
   • Classes
   • Inheritance
Getting Started

• Things you should know
 • Classical OO
   • Classes
   • Inheritance
   • Polymorphism
Getting Started
Getting Started

• Recommended but not required
Getting Started

• Recommended but not required
 • Some knowledge of C
Getting Started

• Recommended but not required
 • Some knowledge of C
   • malloc() . . . free() ?
Getting Started

• Recommended but not required
 • Some knowledge of C
   • malloc() . . . free() ?
 • Some knowledge of design patterns:
Getting Started

• Recommended but not required
 • Some knowledge of C
   • malloc() . . . free() ?
 • Some knowledge of design patterns:
   • MVC, Singleton, Delegation
About Objective-C
About Objective-C
• Object Oriented superset over C
About Objective-C
• Object Oriented superset over C
                 Standard C
About Objective-C
• Object Oriented superset over C
                 Standard C


                 Objective-C
About Objective-C
• Object Oriented superset over C
                  Standard C


                  Objective-C



• Anything that works in C will work in
  Objective-C
Obj-C in 10 minutes
Obj-C in 10 minutes
• All the things you know from C
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
 • int, float, double, char
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
 • int, float, double, char
  int foo = 5;
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
 • int, float, double, char
  int foo = 5;

 • Separate compilation
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
 • int, float, double, char
  int foo = 5;

 • Separate compilation
  • .h for interface declaration
Obj-C in 10 minutes
• All the things you know from C
• Variables are typed:
 • int, float, double, char
  int foo = 5;

 • Separate compilation
  • .h for interface declaration
  • .m for implementation (instead of .c)
Obj-C in 10 minutes
Obj-C in 10 minutes
• Functions / Methods have return types and
  typed arguments
Obj-C in 10 minutes
• Functions / Methods have return types and
  typed arguments
  int sumOfItems(int i, int j)
  {
      return i + j;
  }
Obj-C in 10 minutes
• Functions / Methods have return types and
  typed arguments
  int sumOfItems(int i, int j)
  {
      return i + j;
  }


• Other types
Obj-C in 10 minutes
• Functions / Methods have return types and
  typed arguments
  int sumOfItems(int i, int j)
  {
      return i + j;
  }


• Other types
 • void, NULL
Obj-C in 10 minutes
• Functions / Methods have return types and
  typed arguments
  int sumOfItems(int i, int j)
  {
      return i + j;
  }


• Other types
 • void, NULL
 • pointers to types (int *, void *)
Obj-C in 10 minutes
Obj-C in 10 minutes
• Objective-C Additions:
Obj-C in 10 minutes
• Objective-C Additions:
 • BOOL - YES / NO
Obj-C in 10 minutes
• Objective-C Additions:
 • BOOL - YES / NO
  BOOL isSet = YES;
Obj-C in 10 minutes
• Objective-C Additions:
 • BOOL - YES / NO
  BOOL isSet = YES;



 • id - strictly a pointer to an object
Obj-C in 10 minutes
• Objective-C Additions:
 • BOOL - YES / NO
  BOOL isSet = YES;



 • id - strictly a pointer to an object
 • nil - a zero’d out pointer
Obj-C in 10 minutes
• Objective-C Additions:
 • BOOL - YES / NO
  BOOL isSet = YES;



 • id - strictly a pointer to an object
 • nil - a zero’d out pointer
  • nil != (necessarily) NULL or 0
Obj-C in 10 minutes
Obj-C in 10 minutes
•   Classes
Obj-C in 10 minutes
•   Classes
    •   Exist as a class pair
Obj-C in 10 minutes
•   Classes
    •   Exist as a class pair
        •   Instance variables and instance methods act
            on an instance object
Obj-C in 10 minutes
•   Classes
    •   Exist as a class pair
        •   Instance variables and instance methods act
            on an instance object
        •   Class (static) methods act on the class
            object
Obj-C in 10 minutes
•   Classes
    •   Exist as a class pair
        •   Instance variables and instance methods act
            on an instance object
        •   Class (static) methods act on the class
            object
        •   There is only ever one class object at any
            given time
Obj-C in 10 minutes
•   Classes
    •   Exist as a class pair
        •   Instance variables and instance methods act
            on an instance object
        •   Class (static) methods act on the class
            object
        •   There is only ever one class object at any
            given time
        •   Class variables really don’t exist
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes                              Include a header
  #import <Foundation/Foundation.h>
                                              file
  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>
                                       Declare interface
  @interface MyClass : NSObject            extends
  {
                                          NSObject
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;                  Class instance
      NSArray *someItems;                 variables
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
                                        A class (static)
  - (void)logMe;                           method

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;                         An instance
                                          method
  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }
                                          A declared
  + (NSString *)className;                 property
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;
                                           Close the
  @end
                                        interface block
Obj-C in 10 minutes
• Classes
  #import <Foundation/Foundation.h>

  @interface MyClass : NSObject
  {
      id aChildObject;
      NSArray *someItems;
  }

  + (NSString *)className;
  - (void)logMe;

  @property (nonatomic, retain) id aChildObject;

  @end
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"
                                       Include a header
                                              file
  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"
                                             Begin
  @implementation MyClass               implementation
  @synthesize aChildObject;                  block
  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;
                                        Auto-generate
                                          property
  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init                               Initializer
  {                                      (constructor)
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
                                         Call to super
      if (self)                               class
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];               “new”   an array
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {                                             Destructor
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
                                           Instance method
  {                                         implementation
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");                    Class method
  }                                        implementation
  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);     End
  }
                                            implementation
  @end                                           block
Obj-C in 10 minutes
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
Obj-C in 10 minutes
Obj-C in 10 minutes
• What’s with all the ‘@’ and ‘[ ]’?
Obj-C in 10 minutes
• What’s with all the ‘@’ and ‘[ ]’?
•@
 • Objective-C keywords
 • Initializer for string constants
Obj-C in 10 minutes
• What’s with all the ‘@’ and ‘[ ]’?
•@
 • Objective-C keywords
 • Initializer for string constants
• ‘[]’
 • “Send a message to an object”
 • Like calling a method, but more dynamic
Obj-C in 10 minutes
Obj-C in 10 minutes
• Method Calls (messages)
Obj-C in 10 minutes
• Method Calls (messages)
• Names are intermixed with arguments:
Obj-C in 10 minutes
• Method Calls (messages)
• Names are intermixed with arguments:
 • method definition
  - (void)setItems:(NSArray *)items childObject:(id)obj;
Obj-C in 10 minutes
• Method Calls (messages)
• Names are intermixed with arguments:
 • method definition
  - (void)setItems:(NSArray *)items childObject:(id)obj;



 • method call
  [self setItems:[NSArray array] childObject:object];
Obj-C in 10 minutes


- (void)setItems:(NSArray *)items childObject:(id)obj;
Obj-C in 10 minutes
Return
 Type

- (void)setItems:(NSArray *)items childObject:(id)obj;
Obj-C in 10 minutes
Return
 Type

- (void)setItems:(NSArray *)items childObject:(id)obj;




                  Method Name
Obj-C in 10 minutes
Return
 Type                     Arguments and Types


- (void)setItems:(NSArray *)items childObject:(id)obj;




                  Method Name
Obj-C in 10 minutes


[self setItems:[NSArray array] childObject:object];
Obj-C in 10 minutes

Receiver

 [self setItems:[NSArray array] childObject:object];
Obj-C in 10 minutes

Receiver

 [self setItems:[NSArray array] childObject:object];




                Method Name
Obj-C in 10 minutes

Receiver                    Arguments


 [self setItems:[NSArray array] childObject:object];




                Method Name
Obj-C in 10 minutes
Obj-C in 10 minutes
• Protocols
Obj-C in 10 minutes
• Protocols
 • Analogous to interfaces
  @protocol MyProtocol <NSObject>

  - (void)protocolMethod;
  @property (nonatomic, retain) NSObject *anObject;

  @end
Obj-C in 10 minutes
• Protocols
 • Analogous to interfaces
  @protocol MyProtocol <NSObject>

  - (void)protocolMethod;
  @property (nonatomic, retain) NSObject *anObject;

  @end



 • Adopting a protocol
  @interface MyClass : NSObject <MyProtocol>
Obj-C in 10 minutes
• Categories - Something completely
  different
• Add functionality to an existing class
  @interface NSString (firstChar)
  - (unichar)firstChar;
  @end

  @implementation NSString (reverse)

  - (unichar)firstChar
  {
      return [self characterAtIndex:0];
  }

  @end
iOS in 10 Minutes
Key Objects
Key Objects
•   UIViewController

    •   Contains a view, manages all the information and
        widgets on the view.

    •   One Controller per view (screen)
Key Objects
•   UIViewController

    •   Contains a view, manages all the information and
        widgets on the view.

    •   One Controller per view (screen)

•   UIView

    •   The view itself. All UI widgets inherit from
        UIView.

    •   Objects on a view are “subviews” of that view
Key Patterns
MVC
Key Patterns
 MVC




Model
Key Patterns
 MVC




Model                  View
Key Patterns
 MVC




Model      Controller   View
Key Patterns
Key Patterns
• Delegation (Datasource)
Key Patterns
• Delegation (Datasource)
  • Alleviates subclassing
Key Patterns
  • Delegation (Datasource)
    • Alleviates subclassing

“I’m a table view. The user tapped the fourth cell.
Thought you should know.”
Key Patterns
  • Delegation (Datasource)
    • Alleviates subclassing

“I’m a table view. You need to give me a cell object to
display at row 5. I don’t really care what’s in it.”
Delegation
             Delegate
Delegation
                       Delegate
“How many sections?”
Delegation
                       Delegate
“How many sections?”

         “1”
Delegation
                       Delegate
“How many sections?”

         “1”


“How many rows?”
Delegation
                       Delegate
“How many sections?”

         “1”


“How many rows?”

        “2”
Delegation
             Delegate
Delegation
                            Delegate
“I need a cell for row 0”
Delegation
                            Delegate
“I need a cell for row 0”
Delegation
                            Delegate
“I need a cell for row 0”




“Someone tapped row 0”
UITableView

• Interface declares the datasource and
  delegate protocols:
UITableView

• Interface declares the datasource and
  delegate protocols:
  @interface FirstViewController : UIViewController
      <UITableViewDelegate, UITableViewDataSource>
UITableview
• Implements the required methods:
UITableview
• Implements the required methods:
  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

  - (NSInteger)tableView:(UITableView *)tableView
  numberOfRowsInSection:(NSInteger)section

  - (UITableViewCell *)tableView:(UITableView *)tableView
  cellForRowAtIndexPath:(NSIndexPath *)indexPath

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
  (NSIndexPath *)indexPath
iOS 5
iOS 5
•   Thousands of new APIs

•   Newly available frameworks

•   Game Center

•   Automatic Reference Counting

•   Storyboards

•   iCloud

•   It’s really really really big
Things we’ll cover:
Things we’ll cover:

• Automatic Reference Counting
Things we’ll cover:

• Automatic Reference Counting
• Twitter framework
Things we’ll cover:

• Automatic Reference Counting
• Twitter framework
• UIAppearance customization
Things we’ll cover:

• Automatic Reference Counting
• Twitter framework
• UIAppearance customization
• CoreImage Filters
Lobstagram
A Brief Tour
A Brief Tour
•   A Table View of images already
    taken
A Brief Tour
•   A Table View of images already
    taken

•   Camera button chooses a photo
    (or takes a photo)
A Brief Tour
•   A Table View of images already
    taken

•   Camera button chooses a photo
    (or takes a photo)

•   Next view applies the photo title
    and saves to CoreData
A Brief Tour
•   A Table View of images already
    taken

•   Camera button chooses a photo
    (or takes a photo)

•   Next view applies the photo title
    and saves to CoreData

•   Table refreshes.
A Brief Tour
•   A Table View of images already
    taken

•   Camera button chooses a photo
    (or takes a photo)

•   Next view applies the photo title
    and saves to CoreData

•   Table refreshes.

•   Not worth $1 Billion
A Brief Tour
A Brief Tour
•   UITableView as described earlier.
A Brief Tour
•   UITableView as described earlier.

•   UIImagePickerViewController is an
    easy to use built in control.
A Brief Tour
•   UITableView as described earlier.

•   UIImagePickerViewController is an
    easy to use built in control.

•   CoreData is an ORM on steroids
    for working with persistent
    storage.
A Brief Tour
•   UITableView as described earlier.

•   UIImagePickerViewController is an
    easy to use built in control.

•   CoreData is an ORM on steroids
    for working with persistent
    storage.

•   All written in ARC code.
The Dark Ages
The Dark Ages
•   Manual Memory Management
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
        •   alloc . . . init
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
        •   alloc . . . init
        •   retain
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
        •   alloc . . . init
        •   retain
        •   release
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
        •   alloc . . . init
        •   retain
        •   release
        •   autorelease
The Dark Ages
•   Manual Memory Management

    •   No garbage collection as in C#, Java, Ruby,
        PHP, Python
    •   Reference counting system implemented on
        NSObject.
        •   alloc . . . init
        •   retain
        •   release
        •   autorelease
        •   dealloc
Manual Memory
        Management
• Classes
  #import "MyClass.h"

  @implementation MyClass
  @synthesize aChildObject;

  - (id)init
  {
      self = [super init];
      if (self)
      {
          someItems = [[NSArray alloc] init];
      }

      return self;
  }
Manual Memory
          Management
• Continued . . .
  - (void)dealloc
  {
      [aChildObject release];
      [someItems release];
      [super dealloc];
  }

  - (void)logMe
  {
      NSLog(@"MyClass");
  }

  + (NSString *)className
  {
      return NSStringFromClass([self class]);
  }

  @end
No Longer
To The Code!
ARC Decorators
ARC Decorators

• __strong - owning reference (default)
ARC Decorators

• __strong - owning reference (default)
• __weak - non-owning reference
ARC Decorators

• __strong - owning reference (default)
• __weak - non-owning reference
• __unsafe_unretained - manual management
ARC Decorators

• __strong - owning reference (default)
• __weak - non-owning reference
• __unsafe_unretained - manual management
• __autoreleasing - used in out parameters
ARC Decorators

• __strong - owning reference (default)
• __weak - non-owning reference
• __unsafe_unretained - manual management
• __autoreleasing - used in out parameters
• No dealloc
Using __weak
• Use __weak to refer to an object that
  you’re confident will be retained elsewhere.
Using __weak
• Use __weak to refer to an object that
  you’re confident will be retained elsewhere.


  NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar",
  @"baz", nil];

  // The array is owning all the objects in it, so we don't
  // need a strong reference here (but there's nothing wrong
  with it)
  NSString * __weak first = [array objectAtIndex:0];
__unsafe_unretained
__unsafe_unretained
• Used for backwards compatibility with iOS
  4.
__unsafe_unretained
• Used for backwards compatibility with iOS
  4.
• Pointer is NOT nil’d out after deallocation.
__unsafe_unretained
• Used for backwards compatibility with iOS
  4.
• Pointer is NOT nil’d out after deallocation.
  // nil initialization is automatic
  NSNumber * __unsafe_unretained n = nil;
  if (YES)
  {
      n = [[NSNumber alloc] initWithInt:25];
      NSLog(@"%@", n);
  }

  // n loses scope
  NSLog(@"%@", n);   // CRASH! (probably)
__unsafe_unretained
• Used for backwards compatibility with iOS
  4.
• Pointer is NOT nil’d out after deallocation.
  // nil initialization is automatic
  NSNumber * __unsafe_unretained n = nil;
  if (YES)
  {
      n = [[NSNumber alloc] initWithInt:25];
      NSLog(@"%@", n);
  }
  // n loses scope
  n = nil;
  NSLog(@"%@", n); // a-ok
__autoreleasing
        • Used with out parameters
NSError * __autoreleasing error = nil;
if (![managedObjectContext save:&error])
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                     message:@"The photo could not be saved"
                                                    delegate:nil
                                           cancelButtonTitle:@"Ok"
                                           otherButtonTitles:nil];
     [alert show];
}
else
{
     [delegate photoSettingsViewController:self didSaveNewPhoto:photo];
}



        • (Note, the compiler will rewrite this if you
             use a strong reference)
So what?
So what?
•   ARC drastically reduces up front development
    time.
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.

•   ARC is not perfect:
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.

•   ARC is not perfect:

    •   Still possible to have retain cycle
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.

•   ARC is not perfect:

    •   Still possible to have retain cycle

    •   Still need to understand pointer scope
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.

•   ARC is not perfect:

    •   Still possible to have retain cycle

    •   Still need to understand pointer scope

    •   Doesn’t work on CF objects
So what?
•   ARC drastically reduces up front development
    time.

•   ARC drastically reduces debugging time.

•   ARC is not perfect:

    •   Still possible to have retain cycle

    •   Still need to understand pointer scope

    •   Doesn’t work on CF objects

•   The compiler is smarter than you.
Twitter Integration
     (Couldn’t be easier)
Twitter.framework
Twitter.framework
• TWTweetComposeViewController
Twitter.framework
• TWTweetComposeViewController
 • Super easy view for composing a tweet
Twitter.framework
• TWTweetComposeViewController
 • Super easy view for composing a tweet
• TWRequest
Twitter.framework
• TWTweetComposeViewController
 • Super easy view for composing a tweet
• TWRequest
 • Encapsulates the handling of HTTP
    requests to the Twitter server.
Twitter.framework
• TWTweetComposeViewController
 • Super easy view for composing a tweet
• TWRequest
 • Encapsulates the handling of HTTP
    requests to the Twitter server.
• Requires the user to have set up Twitter in
  the device’s settings.
Tweet Composer

•   Appears looking great
    automatically.

•   Can add links and images

•   Literally zero
    configuration.
To The Code!
Customizing
Appearance
Not a billion dollar app
The Dark Ages
The Dark Ages
• UI Customization was labor intensive
The Dark Ages
• UI Customization was labor intensive
• Every instance of a widget had to be
  customized individually.
The Dark Ages
• UI Customization was labor intensive
• Every instance of a widget had to be
  customized individually.
 • Subclassing
The Dark Ages
• UI Customization was labor intensive
• Every instance of a widget had to be
  customized individually.
 • Subclassing
 • Helper methods
The Dark Ages
• UI Customization was labor intensive
• Every instance of a widget had to be
  customized individually.
 • Subclassing
 • Helper methods
 • Overriding drawRect or haphazardly
    adding subviews.
UIAppearance
• Certain UI Widgets expose an “appearance
  proxy” which can be customized once and
  the look persists everywhere.
  [[UINavigationBar appearance] setTitleTextAttributes:navBarTextProperties];
  [[UILabel appearanceWhenContainedIn:[UIButton class], nil] setTextColor:
  [UIColor whiteColor]];



• Elements can also be customized
  individually via the same methods.
What it’s not . . .

•   A Cascading Style Sheet

    •   Outermost rule breaks a tie-
        breaker

    •   No way to specify things by Id

    •   Unexpected consequences . . .
To The Code!
Much Better
Much Better
CoreImage
CoreImage
CoreImage

• A mature Mac-OS framework brought to
  iOS.
CoreImage

• A mature Mac-OS framework brought to
  iOS.
• Built in inclusion of filters for use
CoreImage

• A mature Mac-OS framework brought to
  iOS.
• Built in inclusion of filters for use
• Plays nice with UIImage and CGImageRef
CoreImage Bits
CoreImage Bits

• CIImage - a recipe for creating an image.
CoreImage Bits

• CIImage - a recipe for creating an image.
• CIFilter - an ingredient in the recipe.
CoreImage Bits

• CIImage - a recipe for creating an image.
• CIFilter - an ingredient in the recipe.
• CIContext - the mixing bowl
CoreImage Workflow
CoreImage Workflow

• Create a CIContext
CoreImage Workflow

• Create a CIContext
• Grab an input image
CoreImage Workflow

• Create a CIContext
• Grab an input image
• Declare and configure a filter
CoreImage Workflow

• Create a CIContext
• Grab an input image
• Declare and configure a filter
• Get the output image from the filter
CoreImage Workflow

• Create a CIContext
• Grab an input image
• Declare and configure a filter
• Get the output image from the filter
• Billion dollar profit
Some caveats
• Documentation is scant
 • The core image filter list applies to
     MacOS only.
  • To get the full list available on the iPhone:
NSLog(@"%@", [CIFilter filterNamesInCategory:kCICategoryBuiltIn]);



  • There are filters in the device that aren’t
     documented.
To The Code!
iOS 5 Development

• Web:
    pzearfoss@gmail.com
    http://zearfoss.wordpress.com
    @pzearfoss
    http://www.github.com/pzearfoss
https://github.com/pzearfoss/Lobstagram

Weitere ähnliche Inhalte

Was ist angesagt?

Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaCharles Nutter
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015Charles Nutter
 
Type Profiler: An Analysis to guess type signatures
Type Profiler: An Analysis to guess type signaturesType Profiler: An Analysis to guess type signatures
Type Profiler: An Analysis to guess type signaturesmametter
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboyKenneth Geisshirt
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLou Loizides
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming IntroLou Loizides
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Charles Nutter
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)mircodotta
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Guillaume Laforge
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++nsm.nikhil
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Eugene Lazutkin
 
JRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVMJRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVMCharles Nutter
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference CountingGiuseppe Arici
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokusHamletDRC
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandCharles Nutter
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015Charles Nutter
 
Object Calisthenics em Go
Object Calisthenics em GoObject Calisthenics em Go
Object Calisthenics em GoElton Minetto
 

Was ist angesagt? (20)

Fast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible JavaFast as C: How to Write Really Terrible Java
Fast as C: How to Write Really Terrible Java
 
JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015JRuby and Invokedynamic - Japan JUG 2015
JRuby and Invokedynamic - Japan JUG 2015
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Node.js extensions in C++
Node.js extensions in C++Node.js extensions in C++
Node.js extensions in C++
 
Type Profiler: An Analysis to guess type signatures
Type Profiler: An Analysis to guess type signaturesType Profiler: An Analysis to guess type signatures
Type Profiler: An Analysis to guess type signatures
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Louis Loizides iOS Programming Introduction
Louis Loizides iOS Programming IntroductionLouis Loizides iOS Programming Introduction
Louis Loizides iOS Programming Introduction
 
iOS Programming Intro
iOS Programming IntroiOS Programming Intro
iOS Programming Intro
 
JavaScript Patterns
JavaScript PatternsJavaScript Patterns
JavaScript Patterns
 
Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016Ruby Performance - The Last Mile - RubyConf India 2016
Ruby Performance - The Last Mile - RubyConf India 2016
 
Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)Effective Scala (JavaDay Riga 2013)
Effective Scala (JavaDay Riga 2013)
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 
Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)Dojo for programmers (TXJS 2010)
Dojo for programmers (TXJS 2010)
 
JRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVMJRuby 9000 - Optimizing Above the JVM
JRuby 9000 - Optimizing Above the JVM
 
Automatic Reference Counting
Automatic Reference CountingAutomatic Reference Counting
Automatic Reference Counting
 
AST Transformations at JFokus
AST Transformations at JFokusAST Transformations at JFokus
AST Transformations at JFokus
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM Wonderland
 
JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015JRuby 9000 - Taipei Ruby User's Group 2015
JRuby 9000 - Taipei Ruby User's Group 2015
 
Object Calisthenics em Go
Object Calisthenics em GoObject Calisthenics em Go
Object Calisthenics em Go
 

Andere mochten auch

iOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechiOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechBruno Pires
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1Hussain Behestee
 
iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001Alexandru Terente
 
What Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersWhat Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersBen Gaddis
 

Andere mochten auch (8)

iOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTechiOS 5 Kick-Start @ISELTech
iOS 5 Kick-Start @ISELTech
 
iOS - development
iOS - developmentiOS - development
iOS - development
 
iOS5 NewStuff
iOS5 NewStuffiOS5 NewStuff
iOS5 NewStuff
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
 
iOS 5
iOS 5iOS 5
iOS 5
 
iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001iOS 5 Tech Talk World Tour 2011 draft001
iOS 5 Tech Talk World Tour 2011 draft001
 
What Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for MarketersWhat Apple's iOS 5 Means for Marketers
What Apple's iOS 5 Means for Marketers
 
iOS PPT
iOS PPTiOS PPT
iOS PPT
 

Ähnlich wie Fwt ios 5

MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
Objective-C talk
Objective-C talkObjective-C talk
Objective-C talkbradringel
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not JavaChris Adamson
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CDataArt
 
Cappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkCappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkAndreas Korth
 
Objective C 基本介紹
Objective C 基本介紹Objective C 基本介紹
Objective C 基本介紹Giga Cheng
 
Dependency Injection: Why is awesome and why should I care?
Dependency Injection: Why is awesome and why should I care?Dependency Injection: Why is awesome and why should I care?
Dependency Injection: Why is awesome and why should I care?devObjective
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)Eduard Tomàs
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, SwiftYandex
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application DevelopmentDhaval Kaneria
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev introVonbo
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone developmentVonbo
 
Refactor your way forward
Refactor your way forwardRefactor your way forward
Refactor your way forwardJorge Ortiz
 
Working with Cocoa and Objective-C
Working with Cocoa and Objective-CWorking with Cocoa and Objective-C
Working with Cocoa and Objective-CKazunobu Tasaka
 

Ähnlich wie Fwt ios 5 (20)

MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
Objective-C talk
Objective-C talkObjective-C talk
Objective-C talk
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not Java
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
 
Cappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application FrameworkCappuccino - A Javascript Application Framework
Cappuccino - A Javascript Application Framework
 
Objective C 基本介紹
Objective C 基本介紹Objective C 基本介紹
Objective C 基本介紹
 
Introduction to c ++ part -1
Introduction to c ++   part -1Introduction to c ++   part -1
Introduction to c ++ part -1
 
About Python
About PythonAbout Python
About Python
 
Dependency Injection: Why is awesome and why should I care?
Dependency Injection: Why is awesome and why should I care?Dependency Injection: Why is awesome and why should I care?
Dependency Injection: Why is awesome and why should I care?
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
 
Objective-C for iOS Application Development
Objective-C for iOS Application DevelopmentObjective-C for iOS Application Development
Objective-C for iOS Application Development
 
iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev intro
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
Refactor your way forward
Refactor your way forwardRefactor your way forward
Refactor your way forward
 
Working with Cocoa and Objective-C
Working with Cocoa and Objective-CWorking with Cocoa and Objective-C
Working with Cocoa and Objective-C
 
Python in 90 minutes
Python in 90 minutesPython in 90 minutes
Python in 90 minutes
 

Kürzlich hochgeladen

What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Kürzlich hochgeladen (20)

What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

Fwt ios 5

  • 2. iOS 5 • About Me: • Pat Zearfoss • Mindgrub Technologies, LLC • BS Computer Science - UMBC 2008 • Working with mobile and iOS for 4 years.
  • 3. iOS 5 • Web: pzearfoss@gmail.com http://zearfoss.wordpress.com @pzearfoss http://www.github.com/pzearfoss
  • 5. Where we’re going: • Quick Objective-c and iOS review
  • 6. Where we’re going: • Quick Objective-c and iOS review • Overview of iOS 5 additions and changes
  • 7. Where we’re going: • Quick Objective-c and iOS review • Overview of iOS 5 additions and changes • Introducing Lobstagram
  • 8. Where we’re going: • Quick Objective-c and iOS review • Overview of iOS 5 additions and changes • Introducing Lobstagram • Other iOS 5 features (as time permits)
  • 10. About iOS Development • Objective-c only
  • 11. About iOS Development • Objective-c only • Other tools are getting better:
  • 12. About iOS Development • Objective-c only • Other tools are getting better: • Titanium, PhoneGap, MonoTouch
  • 13. About iOS Development • Objective-c only • Other tools are getting better: • Titanium, PhoneGap, MonoTouch • Mac required
  • 14. About iOS Development • Objective-c only • Other tools are getting better: • Titanium, PhoneGap, MonoTouch • Mac required • Xcode required (free!)
  • 18. Getting Started • Things you should know
  • 19. Getting Started • Things you should know • Classical OO
  • 20. Getting Started • Things you should know • Classical OO • Classes
  • 21. Getting Started • Things you should know • Classical OO • Classes • Inheritance
  • 22. Getting Started • Things you should know • Classical OO • Classes • Inheritance • Polymorphism
  • 25. Getting Started • Recommended but not required • Some knowledge of C
  • 26. Getting Started • Recommended but not required • Some knowledge of C • malloc() . . . free() ?
  • 27. Getting Started • Recommended but not required • Some knowledge of C • malloc() . . . free() ? • Some knowledge of design patterns:
  • 28. Getting Started • Recommended but not required • Some knowledge of C • malloc() . . . free() ? • Some knowledge of design patterns: • MVC, Singleton, Delegation
  • 30. About Objective-C • Object Oriented superset over C
  • 31. About Objective-C • Object Oriented superset over C Standard C
  • 32. About Objective-C • Object Oriented superset over C Standard C Objective-C
  • 33. About Objective-C • Object Oriented superset over C Standard C Objective-C • Anything that works in C will work in Objective-C
  • 34. Obj-C in 10 minutes
  • 35. Obj-C in 10 minutes • All the things you know from C
  • 36. Obj-C in 10 minutes • All the things you know from C • Variables are typed:
  • 37. Obj-C in 10 minutes • All the things you know from C • Variables are typed: • int, float, double, char
  • 38. Obj-C in 10 minutes • All the things you know from C • Variables are typed: • int, float, double, char int foo = 5;
  • 39. Obj-C in 10 minutes • All the things you know from C • Variables are typed: • int, float, double, char int foo = 5; • Separate compilation
  • 40. Obj-C in 10 minutes • All the things you know from C • Variables are typed: • int, float, double, char int foo = 5; • Separate compilation • .h for interface declaration
  • 41. Obj-C in 10 minutes • All the things you know from C • Variables are typed: • int, float, double, char int foo = 5; • Separate compilation • .h for interface declaration • .m for implementation (instead of .c)
  • 42. Obj-C in 10 minutes
  • 43. Obj-C in 10 minutes • Functions / Methods have return types and typed arguments
  • 44. Obj-C in 10 minutes • Functions / Methods have return types and typed arguments int sumOfItems(int i, int j) { return i + j; }
  • 45. Obj-C in 10 minutes • Functions / Methods have return types and typed arguments int sumOfItems(int i, int j) { return i + j; } • Other types
  • 46. Obj-C in 10 minutes • Functions / Methods have return types and typed arguments int sumOfItems(int i, int j) { return i + j; } • Other types • void, NULL
  • 47. Obj-C in 10 minutes • Functions / Methods have return types and typed arguments int sumOfItems(int i, int j) { return i + j; } • Other types • void, NULL • pointers to types (int *, void *)
  • 48. Obj-C in 10 minutes
  • 49. Obj-C in 10 minutes • Objective-C Additions:
  • 50. Obj-C in 10 minutes • Objective-C Additions: • BOOL - YES / NO
  • 51. Obj-C in 10 minutes • Objective-C Additions: • BOOL - YES / NO BOOL isSet = YES;
  • 52. Obj-C in 10 minutes • Objective-C Additions: • BOOL - YES / NO BOOL isSet = YES; • id - strictly a pointer to an object
  • 53. Obj-C in 10 minutes • Objective-C Additions: • BOOL - YES / NO BOOL isSet = YES; • id - strictly a pointer to an object • nil - a zero’d out pointer
  • 54. Obj-C in 10 minutes • Objective-C Additions: • BOOL - YES / NO BOOL isSet = YES; • id - strictly a pointer to an object • nil - a zero’d out pointer • nil != (necessarily) NULL or 0
  • 55. Obj-C in 10 minutes
  • 56. Obj-C in 10 minutes • Classes
  • 57. Obj-C in 10 minutes • Classes • Exist as a class pair
  • 58. Obj-C in 10 minutes • Classes • Exist as a class pair • Instance variables and instance methods act on an instance object
  • 59. Obj-C in 10 minutes • Classes • Exist as a class pair • Instance variables and instance methods act on an instance object • Class (static) methods act on the class object
  • 60. Obj-C in 10 minutes • Classes • Exist as a class pair • Instance variables and instance methods act on an instance object • Class (static) methods act on the class object • There is only ever one class object at any given time
  • 61. Obj-C in 10 minutes • Classes • Exist as a class pair • Instance variables and instance methods act on an instance object • Class (static) methods act on the class object • There is only ever one class object at any given time • Class variables really don’t exist
  • 62. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 63. Obj-C in 10 minutes • Classes Include a header #import <Foundation/Foundation.h> file @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 64. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> Declare interface @interface MyClass : NSObject extends { NSObject id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 65. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; Class instance NSArray *someItems; variables } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 66. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; A class (static) - (void)logMe; method @property (nonatomic, retain) id aChildObject; @end
  • 67. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; An instance method @property (nonatomic, retain) id aChildObject; @end
  • 68. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } A declared + (NSString *)className; property - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 69. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; Close the @end interface block
  • 70. Obj-C in 10 minutes • Classes #import <Foundation/Foundation.h> @interface MyClass : NSObject { id aChildObject; NSArray *someItems; } + (NSString *)className; - (void)logMe; @property (nonatomic, retain) id aChildObject; @end
  • 71. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 72. Obj-C in 10 minutes • Classes #import "MyClass.h" Include a header file @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 73. Obj-C in 10 minutes • Classes #import "MyClass.h" Begin @implementation MyClass implementation @synthesize aChildObject; block - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 74. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; Auto-generate property - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 75. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init Initializer { (constructor) self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 76. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 77. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; Call to super if (self) class { someItems = [[NSArray alloc] init]; } return self; }
  • 78. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; “new” an array if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 79. Obj-C in 10 minutes • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 80. Obj-C in 10 minutes • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 81. Obj-C in 10 minutes • Continued . . . - (void)dealloc { Destructor [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 82. Obj-C in 10 minutes • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe Instance method { implementation NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 83. Obj-C in 10 minutes • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); Class method } implementation + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 84. Obj-C in 10 minutes • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); End } implementation @end block
  • 85. Obj-C in 10 minutes • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 86. Obj-C in 10 minutes
  • 87. Obj-C in 10 minutes • What’s with all the ‘@’ and ‘[ ]’?
  • 88. Obj-C in 10 minutes • What’s with all the ‘@’ and ‘[ ]’? •@ • Objective-C keywords • Initializer for string constants
  • 89. Obj-C in 10 minutes • What’s with all the ‘@’ and ‘[ ]’? •@ • Objective-C keywords • Initializer for string constants • ‘[]’ • “Send a message to an object” • Like calling a method, but more dynamic
  • 90. Obj-C in 10 minutes
  • 91. Obj-C in 10 minutes • Method Calls (messages)
  • 92. Obj-C in 10 minutes • Method Calls (messages) • Names are intermixed with arguments:
  • 93. Obj-C in 10 minutes • Method Calls (messages) • Names are intermixed with arguments: • method definition - (void)setItems:(NSArray *)items childObject:(id)obj;
  • 94. Obj-C in 10 minutes • Method Calls (messages) • Names are intermixed with arguments: • method definition - (void)setItems:(NSArray *)items childObject:(id)obj; • method call [self setItems:[NSArray array] childObject:object];
  • 95. Obj-C in 10 minutes - (void)setItems:(NSArray *)items childObject:(id)obj;
  • 96. Obj-C in 10 minutes Return Type - (void)setItems:(NSArray *)items childObject:(id)obj;
  • 97. Obj-C in 10 minutes Return Type - (void)setItems:(NSArray *)items childObject:(id)obj; Method Name
  • 98. Obj-C in 10 minutes Return Type Arguments and Types - (void)setItems:(NSArray *)items childObject:(id)obj; Method Name
  • 99. Obj-C in 10 minutes [self setItems:[NSArray array] childObject:object];
  • 100. Obj-C in 10 minutes Receiver [self setItems:[NSArray array] childObject:object];
  • 101. Obj-C in 10 minutes Receiver [self setItems:[NSArray array] childObject:object]; Method Name
  • 102. Obj-C in 10 minutes Receiver Arguments [self setItems:[NSArray array] childObject:object]; Method Name
  • 103. Obj-C in 10 minutes
  • 104. Obj-C in 10 minutes • Protocols
  • 105. Obj-C in 10 minutes • Protocols • Analogous to interfaces @protocol MyProtocol <NSObject> - (void)protocolMethod; @property (nonatomic, retain) NSObject *anObject; @end
  • 106. Obj-C in 10 minutes • Protocols • Analogous to interfaces @protocol MyProtocol <NSObject> - (void)protocolMethod; @property (nonatomic, retain) NSObject *anObject; @end • Adopting a protocol @interface MyClass : NSObject <MyProtocol>
  • 107. Obj-C in 10 minutes • Categories - Something completely different • Add functionality to an existing class @interface NSString (firstChar) - (unichar)firstChar; @end @implementation NSString (reverse) - (unichar)firstChar { return [self characterAtIndex:0]; } @end
  • 108. iOS in 10 Minutes
  • 110. Key Objects • UIViewController • Contains a view, manages all the information and widgets on the view. • One Controller per view (screen)
  • 111. Key Objects • UIViewController • Contains a view, manages all the information and widgets on the view. • One Controller per view (screen) • UIView • The view itself. All UI widgets inherit from UIView. • Objects on a view are “subviews” of that view
  • 115. Key Patterns MVC Model Controller View
  • 118. Key Patterns • Delegation (Datasource) • Alleviates subclassing
  • 119. Key Patterns • Delegation (Datasource) • Alleviates subclassing “I’m a table view. The user tapped the fourth cell. Thought you should know.”
  • 120. Key Patterns • Delegation (Datasource) • Alleviates subclassing “I’m a table view. You need to give me a cell object to display at row 5. I don’t really care what’s in it.”
  • 121. Delegation Delegate
  • 122. Delegation Delegate “How many sections?”
  • 123. Delegation Delegate “How many sections?” “1”
  • 124. Delegation Delegate “How many sections?” “1” “How many rows?”
  • 125. Delegation Delegate “How many sections?” “1” “How many rows?” “2”
  • 126. Delegation Delegate
  • 127. Delegation Delegate “I need a cell for row 0”
  • 128. Delegation Delegate “I need a cell for row 0”
  • 129. Delegation Delegate “I need a cell for row 0” “Someone tapped row 0”
  • 130. UITableView • Interface declares the datasource and delegate protocols:
  • 131. UITableView • Interface declares the datasource and delegate protocols: @interface FirstViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
  • 132. UITableview • Implements the required methods:
  • 133. UITableview • Implements the required methods: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath
  • 134. iOS 5
  • 135. iOS 5 • Thousands of new APIs • Newly available frameworks • Game Center • Automatic Reference Counting • Storyboards • iCloud • It’s really really really big
  • 137. Things we’ll cover: • Automatic Reference Counting
  • 138. Things we’ll cover: • Automatic Reference Counting • Twitter framework
  • 139. Things we’ll cover: • Automatic Reference Counting • Twitter framework • UIAppearance customization
  • 140. Things we’ll cover: • Automatic Reference Counting • Twitter framework • UIAppearance customization • CoreImage Filters
  • 143. A Brief Tour • A Table View of images already taken
  • 144. A Brief Tour • A Table View of images already taken • Camera button chooses a photo (or takes a photo)
  • 145. A Brief Tour • A Table View of images already taken • Camera button chooses a photo (or takes a photo) • Next view applies the photo title and saves to CoreData
  • 146. A Brief Tour • A Table View of images already taken • Camera button chooses a photo (or takes a photo) • Next view applies the photo title and saves to CoreData • Table refreshes.
  • 147. A Brief Tour • A Table View of images already taken • Camera button chooses a photo (or takes a photo) • Next view applies the photo title and saves to CoreData • Table refreshes. • Not worth $1 Billion
  • 149. A Brief Tour • UITableView as described earlier.
  • 150. A Brief Tour • UITableView as described earlier. • UIImagePickerViewController is an easy to use built in control.
  • 151. A Brief Tour • UITableView as described earlier. • UIImagePickerViewController is an easy to use built in control. • CoreData is an ORM on steroids for working with persistent storage.
  • 152. A Brief Tour • UITableView as described earlier. • UIImagePickerViewController is an easy to use built in control. • CoreData is an ORM on steroids for working with persistent storage. • All written in ARC code.
  • 154. The Dark Ages • Manual Memory Management
  • 155. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python
  • 156. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject.
  • 157. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject. • alloc . . . init
  • 158. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject. • alloc . . . init • retain
  • 159. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject. • alloc . . . init • retain • release
  • 160. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject. • alloc . . . init • retain • release • autorelease
  • 161. The Dark Ages • Manual Memory Management • No garbage collection as in C#, Java, Ruby, PHP, Python • Reference counting system implemented on NSObject. • alloc . . . init • retain • release • autorelease • dealloc
  • 162. Manual Memory Management • Classes #import "MyClass.h" @implementation MyClass @synthesize aChildObject; - (id)init { self = [super init]; if (self) { someItems = [[NSArray alloc] init]; } return self; }
  • 163. Manual Memory Management • Continued . . . - (void)dealloc { [aChildObject release]; [someItems release]; [super dealloc]; } - (void)logMe { NSLog(@"MyClass"); } + (NSString *)className { return NSStringFromClass([self class]); } @end
  • 167. ARC Decorators • __strong - owning reference (default)
  • 168. ARC Decorators • __strong - owning reference (default) • __weak - non-owning reference
  • 169. ARC Decorators • __strong - owning reference (default) • __weak - non-owning reference • __unsafe_unretained - manual management
  • 170. ARC Decorators • __strong - owning reference (default) • __weak - non-owning reference • __unsafe_unretained - manual management • __autoreleasing - used in out parameters
  • 171. ARC Decorators • __strong - owning reference (default) • __weak - non-owning reference • __unsafe_unretained - manual management • __autoreleasing - used in out parameters • No dealloc
  • 172. Using __weak • Use __weak to refer to an object that you’re confident will be retained elsewhere.
  • 173. Using __weak • Use __weak to refer to an object that you’re confident will be retained elsewhere. NSArray *array = [NSArray arrayWithObjects:@"foo", @"bar", @"baz", nil]; // The array is owning all the objects in it, so we don't // need a strong reference here (but there's nothing wrong with it) NSString * __weak first = [array objectAtIndex:0];
  • 175. __unsafe_unretained • Used for backwards compatibility with iOS 4.
  • 176. __unsafe_unretained • Used for backwards compatibility with iOS 4. • Pointer is NOT nil’d out after deallocation.
  • 177. __unsafe_unretained • Used for backwards compatibility with iOS 4. • Pointer is NOT nil’d out after deallocation. // nil initialization is automatic NSNumber * __unsafe_unretained n = nil; if (YES) { n = [[NSNumber alloc] initWithInt:25]; NSLog(@"%@", n); } // n loses scope NSLog(@"%@", n); // CRASH! (probably)
  • 178. __unsafe_unretained • Used for backwards compatibility with iOS 4. • Pointer is NOT nil’d out after deallocation. // nil initialization is automatic NSNumber * __unsafe_unretained n = nil; if (YES) { n = [[NSNumber alloc] initWithInt:25]; NSLog(@"%@", n); } // n loses scope n = nil; NSLog(@"%@", n); // a-ok
  • 179. __autoreleasing • Used with out parameters NSError * __autoreleasing error = nil; if (![managedObjectContext save:&error]) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"The photo could not be saved" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } else { [delegate photoSettingsViewController:self didSaveNewPhoto:photo]; } • (Note, the compiler will rewrite this if you use a strong reference)
  • 181. So what? • ARC drastically reduces up front development time.
  • 182. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time.
  • 183. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time. • ARC is not perfect:
  • 184. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time. • ARC is not perfect: • Still possible to have retain cycle
  • 185. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time. • ARC is not perfect: • Still possible to have retain cycle • Still need to understand pointer scope
  • 186. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time. • ARC is not perfect: • Still possible to have retain cycle • Still need to understand pointer scope • Doesn’t work on CF objects
  • 187. So what? • ARC drastically reduces up front development time. • ARC drastically reduces debugging time. • ARC is not perfect: • Still possible to have retain cycle • Still need to understand pointer scope • Doesn’t work on CF objects • The compiler is smarter than you.
  • 188. Twitter Integration (Couldn’t be easier)
  • 191. Twitter.framework • TWTweetComposeViewController • Super easy view for composing a tweet
  • 192. Twitter.framework • TWTweetComposeViewController • Super easy view for composing a tweet • TWRequest
  • 193. Twitter.framework • TWTweetComposeViewController • Super easy view for composing a tweet • TWRequest • Encapsulates the handling of HTTP requests to the Twitter server.
  • 194. Twitter.framework • TWTweetComposeViewController • Super easy view for composing a tweet • TWRequest • Encapsulates the handling of HTTP requests to the Twitter server. • Requires the user to have set up Twitter in the device’s settings.
  • 195. Tweet Composer • Appears looking great automatically. • Can add links and images • Literally zero configuration.
  • 198. Not a billion dollar app
  • 200. The Dark Ages • UI Customization was labor intensive
  • 201. The Dark Ages • UI Customization was labor intensive • Every instance of a widget had to be customized individually.
  • 202. The Dark Ages • UI Customization was labor intensive • Every instance of a widget had to be customized individually. • Subclassing
  • 203. The Dark Ages • UI Customization was labor intensive • Every instance of a widget had to be customized individually. • Subclassing • Helper methods
  • 204. The Dark Ages • UI Customization was labor intensive • Every instance of a widget had to be customized individually. • Subclassing • Helper methods • Overriding drawRect or haphazardly adding subviews.
  • 205. UIAppearance • Certain UI Widgets expose an “appearance proxy” which can be customized once and the look persists everywhere. [[UINavigationBar appearance] setTitleTextAttributes:navBarTextProperties]; [[UILabel appearanceWhenContainedIn:[UIButton class], nil] setTextColor: [UIColor whiteColor]]; • Elements can also be customized individually via the same methods.
  • 206. What it’s not . . . • A Cascading Style Sheet • Outermost rule breaks a tie- breaker • No way to specify things by Id • Unexpected consequences . . .
  • 212. CoreImage • A mature Mac-OS framework brought to iOS.
  • 213. CoreImage • A mature Mac-OS framework brought to iOS. • Built in inclusion of filters for use
  • 214. CoreImage • A mature Mac-OS framework brought to iOS. • Built in inclusion of filters for use • Plays nice with UIImage and CGImageRef
  • 216. CoreImage Bits • CIImage - a recipe for creating an image.
  • 217. CoreImage Bits • CIImage - a recipe for creating an image. • CIFilter - an ingredient in the recipe.
  • 218. CoreImage Bits • CIImage - a recipe for creating an image. • CIFilter - an ingredient in the recipe. • CIContext - the mixing bowl
  • 221. CoreImage Workflow • Create a CIContext • Grab an input image
  • 222. CoreImage Workflow • Create a CIContext • Grab an input image • Declare and configure a filter
  • 223. CoreImage Workflow • Create a CIContext • Grab an input image • Declare and configure a filter • Get the output image from the filter
  • 224. CoreImage Workflow • Create a CIContext • Grab an input image • Declare and configure a filter • Get the output image from the filter • Billion dollar profit
  • 225. Some caveats • Documentation is scant • The core image filter list applies to MacOS only. • To get the full list available on the iPhone: NSLog(@"%@", [CIFilter filterNamesInCategory:kCICategoryBuiltIn]); • There are filters in the device that aren’t documented.
  • 227. iOS 5 Development • Web: pzearfoss@gmail.com http://zearfoss.wordpress.com @pzearfoss http://www.github.com/pzearfoss
  • 228.

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n
  181. \n
  182. \n
  183. \n
  184. \n
  185. \n
  186. \n
  187. \n
  188. \n
  189. \n
  190. \n
  191. \n
  192. \n
  193. \n
  194. \n
  195. \n
  196. \n
  197. \n
  198. \n
  199. \n
  200. \n
  201. \n
  202. \n
  203. \n
  204. \n
  205. \n
  206. \n
  207. \n
  208. \n
  209. \n
  210. \n
  211. \n
  212. \n
  213. \n
  214. \n
  215. \n
  216. \n
  217. \n
  218. \n
  219. \n
  220. \n
  221. \n
  222. \n
  223. \n
  224. \n
  225. \n