我有一个iOS 5应用程序。 当我要推以我的导航控制器,应用程序崩溃:(应用程序崩溃时,我推新视图控制器self.navigation控制器
这里是我的appDelegate部分:
- (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;
}
这里是我推新视图控制器的方法:
-(IBAction)startPressed:(id)sender
{
NSLog(@"startPressed: called");
//loading RootViewController (mainscreen view)
RootViewController *rootViewController=[[RootViewController alloc] init];
[self.navigationController pushViewController:rootViewController animated:YES];
}
应用程序崩溃at a字符串[self.navigationController pushViewController:rootViewController animated:YES];
请帮帮我。如何解决这个问题?
你有什么问题,看我的答案。但请提供崩溃日志。 – rckoenes 2011-12-30 15:02:03
我觉得在处理自动引用计数模式时出错了。我想我错过了一些东西。这是我第一个启用了自动引用计数模式的ios 5应用程序,其中 – Oleg 2011-12-30 15:59:48
应用程序非常简单。我的startViewController中只有一个按钮。当用户按下它时我试图加载RootViewController。但是,应用程序崩溃:( – Oleg 2011-12-30 16:12:56