• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Fwt ios 5
 

Fwt ios 5

on

  • 1,070 views

My slides for the FWT meetup on 4/11/12

My slides for the FWT meetup on 4/11/12

Statistics

Views

Total Views
1,070
Views on SlideShare
1,068
Embed Views
2

Actions

Likes
0
Downloads
27
Comments
0

2 Embeds 2

http://www.linkedin.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Fwt ios 5 Fwt ios 5 Presentation Transcript

  • 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 minutesReturn Type- (void)setItems:(NSArray *)items childObject:(id)obj;
  • Obj-C in 10 minutesReturn Type- (void)setItems:(NSArray *)items childObject:(id)obj; Method Name
  • Obj-C in 10 minutesReturn 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 minutesReceiver [self setItems:[NSArray array] childObject:object];
  • Obj-C in 10 minutesReceiver [self setItems:[NSArray array] childObject:object]; Method Name
  • Obj-C in 10 minutesReceiver 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 PatternsMVC
  • Key Patterns MVCModel
  • Key Patterns MVCModel View
  • Key Patterns MVCModel 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 todisplay 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 dont // need a strong reference here (but theres 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 parametersNSError * __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!
  • CustomizingAppearance
  • 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