gpt4 book ai didi

ios - '只有当源 Controller 由 UINavigationController 的实例管理时,才能使用 Push segues

转载 作者:技术小花猫 更新时间:2023-10-29 10:46:18 25 4
gpt4 key购买 nike

我遇到了这个问题。在我的 Root View Controller 中,我有一个文本字段和一个按钮。我给出了一个条件,如果我在文本字段中输入 0,那么只有它应该移动到下一个 View 。到这里它工作正常。但现在问题来了。在这里,我有一个按钮并为该按钮导航到第三个 View Controller 。在这里我收到错误信息

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

我在第一个 View 中为按钮提供操作,如下所示

- (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];

}
}

最佳答案

前往:

Editor--> Embed In --> Navigation Controller,添加Navigation Controller到你的初始 View

关于ios - '只有当源 Controller 由 UINavigationController 的实例管理时,才能使用 Push segues,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19223761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com