Reputation: 5616
I have a view based application. I am trying to load a second custom view controller when the app starts. I have the following code :
- (void)viewDidLoad
{
controller = [NewController alloc];
[self presentModalViewController:controller animated:YES];
[controller release];
[super viewDidLoad];
}
The problem is that the new view controller is not loading and viewDidLoad is not called. I have no xib file for the second view controller.
Can anyone help ?
Upvotes: 2
Views: 1270
Reputation: 53171
You're missing a call to init
your view controller...
- (void)viewDidLoad
{
controller = [[NewController alloc] init];
[self presentModalViewController:controller animated:YES];
[controller release];
[super viewDidLoad];
}
Upvotes: 0
Reputation: 10045
It won't work in your viewDidLoad or viewWillAppear methods. Use viewDidAppear
instead.
Upvotes: 4