我遇到了这个问题.在我的根视图控制器中,我有一个文本字段和一个按钮.我给出了一个条件,如果我在文本字段中输入0然后只有它应该移动到下一个视图.到这里它正常工作.但现在这里有问题.在这里,我有一个按钮,并为该按钮提供导航到第三个视图控制器.我在这里得到错误
Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
Run Code Online (Sandbox Code Playgroud)
图片参考:http://img12.imageshack.us/img12/8533/myp5.png
我在第一个视图中给按钮操作,如下所示
- (IBAction)Submit:(id)sender {
if([tf.text isEqual:@"0"])
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
SecondViewController *vc2 = [storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerID" ];
[self presentViewController:vc2 animated:YES completion:NULL];
}
}
Run Code Online (Sandbox Code Playgroud)
查看截图后,您需要
SecondViewController推入现有导航控制器的堆栈,而不是以模态方式呈现它SecondViewController另一个导航控制器,然后从您的SamplesViewController以模态方式创建和呈现该导航控制器无论哪种方式,都SecondViewController需要嵌入导航控制器,然后才能使用Push Segues
| 归档时间: |
|
| 查看次数: |
22371 次 |
| 最近记录: |