【发布时间】:2016-03-22 18:01:10
【问题描述】:
在我的应用程序中,我有一个 UIViewController 和一个 UITableViewController。
我希望从 UIViewController 导航到 UITableViewController。
在 UITableViewController 中,我想要一个导航栏,以便我可以“添加”项目并在“完成”时声明,以便我可以返回我的 UIViewController。
为了实现这一点,我将 UITableViewController 嵌入到 UINavigationController 中,因为它显示了导航栏,我可以在其中添加按钮并添加标题。
我已经将一个 segue 从 UIViewController '控制拖'到 UINavigationController,它本身附加到 UITableViewController。
UIViewController -> UINavigationController -> UITableViewController
我的预期功能是从 UIViewController 到 UITableViewController。但是,应用程序崩溃并显示以下消息:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7f96c1451890>) doesn't contain a view controller with identifier 'UINavigationController-IxO-nE-zon'
如果我的 segue 直接从 UIViewController 附加到 UITableViewController(UINavigationController 消失了),应用程序不会崩溃。但是,我没有在我需要的 UITableViewController 顶部获得导航栏。
所以我的问题是:我可以修复这个错误以便我可以在它们之间旅行,还是有另一种方法可以做到这一点,以便我可以在保持导航栏的同时在它们之间旅行。
谢谢!
【问题讨论】:
-
如果在导航控制器中嵌入
UIViewController,然后推送UITableViewController呢?
标签: xcode swift uinavigationcontroller uinavigationbar