我有这个问题。在我的根视图控制器中,我有一个文本字段和一个按钮。我给出的条件是,如果我在文本字段中输入 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.'
图片参考: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];
}
}