Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS for NSNoobs

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for toulouse toulouse
December 07, 2011

iOS for NSNoobs

Avatar for toulouse

toulouse

December 07, 2011
Tweet

Other Decks in Programming

Transcript

  1. COMMENTS • No dedicated question time scheduled, so... • Ask

    questions as soon as you have them! • That way we can answer them, put them in context, and take notes on *you* for future workshops
  2. COMMENTS • No dedicated question time scheduled, so... • Ask

    questions as soon as you have them! • That way we can answer them, put them in context, and take notes on *you* for future workshops • Be interactive: ask us “why?”, prove us wrong, offer your opinion!
  3. CLASS DEFINITION #import "ItsSuperclass.h" @interface ClassName : ItsSuperclass // Method

    and property declarations. @end ClassName.h #import "ClassName.h" @implementation ClassName { // Instance variable declarations. } // Method definitions. @end ClassName.m
  4. METHOD DEFINITION - (Widget *)widgetWithLength:(int)length width:(int)width color:(UIColor *)color; - (type)nameWithParameter:(parameter_type)aParameter

    anotherParameter:(parameter_type)bParameter; [self fooWithName:[OtherThing name] description:@"This is an NSString" luckyNumber:9]; [@"This is an NSString" uppercaseString];
  5. METHOD DEFINITION + (Widget *)widgetWithLength:(int)length width:(int)width color:(UIColor *)color; + (type)nameWithParameter:(parameter_type)aParameter

    anotherParameter:(parameter_type)bParameter; [Blah fooWithName:[OtherThing name] description:@"This is an NSString" luckyNumber:9]; [NSString stringWithFormat:@"%@", count];
  6. MEMORY MANAGEMENT • Objects only (no primitives) • Video game

    lives • The essentials: retain/release/autorelease
  7. MEMORY MANAGEMENT • Objects only (no primitives) • Video game

    lives • The essentials: retain/release/autorelease • Matching pairs
  8. MEMORY MANAGEMENT • Objects only (no primitives) • Video game

    lives • The essentials: retain/release/autorelease • Matching pairs • How it works in collections
  9. MEMORY MANAGEMENT • Objects only (no primitives) • Video game

    lives • The essentials: retain/release/autorelease • Matching pairs • How it works in collections • Mutability: copy/mutableCopy
  10. @property(nonatomic, retain) Garply *myObject; @synthesize myObject; and - (Garply *)myObject

    { return myObject; } - (void)setMyObject:(Garply *)newObject { if (myObject != newObject) { [myObject release]; myObject = [myObject retain]; } } - (Garply *)myObject; - (void)setMyObject:(Garply *)newObject; and become