Why is my UIViewController initializer never called?

Posted by mystify on Stack Overflow See other posts from Stack Overflow or by mystify
Published on 2010-04-12T13:46:00Z Indexed on 2010/04/12 14:03 UTC
Read the original article Hit count: 274

Filed under:

I made a view-based project from a fresh template. There's a UIViewController which is created with an XIB.

In the implementation I uncommented that and added an NSLog. But this is never called:

// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
        // Custom initialization
        NSLog(@"nib");
    }
    return self;
}

since that is initialized from a nib / xib, that should be called for sure, right? however, it doesn't. I do get an NSLog message when I put that in viewDidLoad.

© Stack Overflow or respective owner

Related posts about iphone