gpt4 book ai didi

iOS - 来自 Storyboard的导航 Controller

转载 作者:行者123 更新时间:2023-11-29 03:48:46 24 4
gpt4 key购买 nike

我已将 View Controller 嵌入到 Storyboard上的导航 Controller 中,然后添加了一个从代码配置的表格 View 。我正在尝试做到这一点,当我单击表中的一行时,它应该更改 View 并将 subview 放入堆栈中,但是我无法访问导航 Controller 。

[self.navigationController pushViewController:disclosureView animated:YES];

当此代码启动时,它会给出错误:“NavController[990:c07] 应用程序试图在目标上推送一个 nil View Controller 。”

最佳答案

我希望你没有正确调用 ViewController :

if(indexPath.row == 0)

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *disclosureView = [storyboard instantiateViewControllerWithIdentifier:@"disclosureView" ];

[self.navigationController pushViewController:disclosureView animated:YES];

这是获取 UIViewController 标识符的屏幕截图: enter image description here

关于iOS - 来自 Storyboard的导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17338172/

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