UINavigationcontroller PushViewController 无法获取下一个 Viewcontroller
我几乎红色了所提供的所有帮助,但我仍然很困惑。我在 Xcode4.2 中有一个带有 sostoryboard 的简单项目。我有导航控制器和两个视图控制器(一、二)。如果我试图使用 PushViewController 从一到二,它就会崩溃。我的问题出在哪里。如果我的故事板中有导航控制器,那么访问和使用它应该不会有问题,对吗?我不会赢得模态窗口应用程序,我使用类似故事板的东西,用户可以在其中前后移动而不会丢失控件数据。我该怎么做才是正确的。
感谢您的帮助我是苹果开发的新手:)
唯一的代码:
- (IBAction)Next:(id)sender{
two* myNext = [[two alloc] initWithNibName:@"two" bundle:nil];
NSLog(@"%@", [self navigationController]);
NSLog(@"%d", [[[self navigationController] viewControllers] count]);
[[self navigationController] pushViewController:myNext animated:YES];
// [[self navigationController] pushViewController:myNext animated:YES];
// [myNext release];
}
I red nearly all the help which is provided, and i'm still confused. I have simple project in Xcode4.2 with sotoryboard. There i have Navigationcontroller and two Viewcontroler (one, two). If i'm trying to get from one to two with pushViewController its break down. Where is my problem. If i have the Navigationcontroler in my storyboard i shouldn't have problem to access it and use it, is it right? I don't won modal window application i use something like story board where the user can move back and front without lose the controls data. How should i do it right.
thanks for any help I'm new to apple developing :)
The only code :
- (IBAction)Next:(id)sender{
two* myNext = [[two alloc] initWithNibName:@"two" bundle:nil];
NSLog(@"%@", [self navigationController]);
NSLog(@"%d", [[[self navigationController] viewControllers] count]);
[[self navigationController] pushViewController:myNext animated:YES];
// [[self navigationController] pushViewController:myNext animated:YES];
// [myNext release];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是更改初始化 UIViewController,因为使用情节提要,您无法使用 initWithNibName。您必须使用 instantiateViewControllerWithIdentifier ,它使用 UIViewController 的标识符属性。标识符属性可以在 sotryboard 中设置。
The solution is to change the initialize UIViewController because of using storyboard you can't use initWithNibName. You have to use instantiateViewControllerWithIdentifier which use identifier property of UIViewController. The identifier property can by set in the sotryboard.