Reputation: 115
When I call loadNibNamed:
in init
, the UIViewController
can't receive viewDidLoad
event.
But if I put call to loadNibNamed:
somewhere else, it works fine. What is the reason?
-(id)init
{
self=[super init];
if(self){
[[NSBundle mainBundle]loadNibNamed:@"MainView" owner:self options:nil];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
Upvotes: 0
Views: 472
Reputation: 9484
This is because when you are writing implementation of init , you are not calling super with nib name correctly.
-(id)init {
self = [super initWithNibName:@"MainView" bundle:nil];
return self;
}
Upvotes: 2