iPhone UINavigation 控制器问题?
我有3个不同的xib。我可以使用以下代码在视图 1 和视图 2 之间来回切换...
此代码将显示第二个视图...
-(IBAction)startButtonClicked:(id)sender{
self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil];
[self.navigationController pushViewController:gamePlayViewController animated:YES];
[GamePlayViewController release];
}
此代码在第二个视图中执行,并将我带回到第一个视图...
-(IBAction)backButtonClicked{
[self.navigationController popViewControllerAnimated:YES];
}
现在,当我尝试执行此代码(在第二个视图中)以进入第三个视图时...我收到 SIGABRT 并且应用程序崩溃...为什么它适用于第一个视图第二个视图,但不是为第二个视图带来第三个视图?
-(IBAction)nextView{
self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
[self.navigationController pushViewController:thirdViewController animated:YES];
[thirdViewController release];
}
I have 3 different xib's. I am able to go back and forth between view 1 and view 2 with the following code...
This Code brings up the second view...
-(IBAction)startButtonClicked:(id)sender{
self.gamePlayViewController = [[GamePlayViewController alloc] initWithNibName:@"GamePlayViewController" bundle:nil];
[self.navigationController pushViewController:gamePlayViewController animated:YES];
[GamePlayViewController release];
}
This Code is executed in the second view and brings me back to the first view...
-(IBAction)backButtonClicked{
[self.navigationController popViewControllerAnimated:YES];
}
Now when I try to execute this code (in the second view) to get to the third view...I get SIGABRT and the app crashes...why does it work for the first view bringing up the second view, but not for the second view bringing up the 3rd view?
-(IBAction)nextView{
self.thirdViewController = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
[self.navigationController pushViewController:thirdViewController animated:YES];
[thirdViewController release];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ThirdViewController.xib 中可能有一些您忘记配置或配置错误的对象或出口。比较和对比 ThirdViewController.xib 和 GamePlayViewController.xib,密切注意如何配置 ThirdViewController.xib 的类名和出口。特别是:
There's probably some object or outlet in ThirdViewController.xib that you've forgotten to configure or misconfigured. Compare and contrast ThirdViewController.xib and GamePlayViewController.xib, paying close attention to how you've configured ThirdViewController.xib's class names and outlets. In particular: