I am using a delegate to store data for my app. I have a tabviewcontroller with a navigationviewcontroller as the first view controller. When i set the delegate using
delegate = [[UIApplication sharedApplication] delegate];
the delegate is null outside of the init method.
It however works fine when places in viewDidLoad. Any ideas why this could be?
UPDATE
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
delegate = [[UIApplication sharedApplication] delegate];
}
return self;
}
The nib file was calling the initWithCoder method, not init.