viewDidLoad never called in Sub-classed UIViewController

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2011-11-26T16:40:28Z Indexed on 2011/11/26 17:50 UTC
Read the original article Hit count: 289

Filed under:
|

I've run into some trouble with loading a sub-classed UIViewController from a nib. My viewDidLoad function is never called.

The super-class has no nib, but the sub-classes each have their own. i.e.

@interface SuperClass : UIViewController {
}
@end


@interface SubClass : SuperClass{
}
@end
@implementation SubClass
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad{
// Never called
}

The view is loaded from a nib as follows:

SubClass *scvc = [[SubClass alloc]     initWithNibName:@"SubClass" bundle:nil];
    [self.navigationController pushViewController:scvc animated:YES];
    [scvc release];

There is a nib file with this name and it has it's file owner's class set properly.

viewDidLoad is not called in the child or super. Any ideas?

© Stack Overflow or respective owner

Related posts about ios

Related posts about ios4