I have an iOS 5 application. When I want to push view to my navigation controller, the application crashes :(
Here's my appDelegate part:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.navigationController=[[UINavigationController alloc] init];
StartViewController *startViewController=[[StartViewController alloc] init];
[self.navigationController pushViewController:startViewController animated:YES];
[self.navigationController setNavigationBarHidden:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
self.window.backgroundColor = [UIColor whiteColor];
self.window.rootViewController=self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
Here's my pushing new view controller method:
-(IBAction)startPressed:(id)sender
{
NSLog(@"startPressed: called");
//loading RootViewController (mainscreen view)
RootViewController *rootViewController=[[RootViewController alloc] init];
[self.navigationController pushViewController:rootViewController animated:YES];
}
Application crashed at a string [self.navigationController pushViewController:rootViewController animated:YES];
Help me, please. How to solve this problem?
Solved the problem. I changed `[self.navigationController pushViewController:vc animated:NO] and debug gave me the warning that the view outlet was not set. So I connected view from interface builder and the problem is gone. Thanks everybody for help