views:

55

answers:

1

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 want to run this upon launch.

Thanks in advance.

+4  A: 

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];
Shaggy Frog