I tried overriding the default initWithNibName designated initializer of a UIViewController subclass like so:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
// Custom initialization
}
return self;
}
I have also included its definition in the header file. However, when my Application Delegate nib loads the viewcontroller, the initializer is not invoked, only -viewDidLoad.
How does the nib magic instantiate my view controller then? Why do all the XCode templates state
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
Is it correct my initWithNibName isn't called when the viewcontroller is loaded form another nib?