A couple of weekends ago I had the privelage of attending the iPhone dev school put on by robots and pencils, and taught by JR and Paul.

It was a fun weekend with a tonne of content packed in to 2 days. Here are a few of my notes from the course.


Method Invocation

Greeting greeting = [[Greeting alloc] init];
 [greeting greet:@"hello world" name:@"Mo"]
 [greeting greet:@"hello world"]

 @implementation Greeting
 -(void)greet:(NSString *)title name:(NSString *)name

Header File

@protocol TempWeatherServiceDelegate <NSObject>
-(void)didFetchWeather:(Weather *)weather;

@interface TempWeatherService : NSObject
@property (nonatomic, weak) id <TempWeatherServiceDelegate> delegate;

Implementation File

@implementation TempWeatherService

@synthesize delegate = _delegate;

  Weather *weather = [[Weather alloc] init];
  weather.currentTemperature = -20;
  [self.delegate didFetchWeather:weather]

Protocols and Delegates

TempWeatherService service = [[TempWeatherService alloc] init];
 service.delegate = self;
 [service fetchWeather]

Notifications (event aggregator)

[NSNotificationCenter defaultCenter]
-(void)addObserver:(id)observer selector:(SEL)methodToCallIfSomethingHappens name:(NSString)name object:(id)sender


comments powered by Disqus