Reputation: 25
View *view1 = [[View alloc] init];
[self presentModalViewController:view1 animated:YES];
The code above works when connected to a UIButton
. It does not work upon launch of an application by putting it in the viewDidLoad:
method. I would like to run this upon launch.
Upvotes: 1
Views: 946
Reputation: 139
Since iOS 6 you should use following method, because of deprections:
MyViewController* myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil]; [self presentViewController:myViewController animated:YES completion:nil];
Upvotes: 0
Reputation: 27601
Look very closely at the method you're calling: presentModalViewController:
presents a controller, not a view.
The correct pattern is something like this:
MyViewController* myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil];
[self presentModalViewController:myViewController animated:YES];
[myViewController release];
Upvotes: 5