ios - Push Segue 的奇怪错误

标签 ios objective-c xcode storyboard

我刚刚使用两个 View 创建了一个带有 Storyboard 的计算器应用程序。我启动了我的模拟器,一开始一切正常。在第一个屏幕上,我可以使用“计算器”按钮切换到第二个屏幕,在第二个屏幕上我有一个返回主菜单的按钮。但是当我第二次从主菜单切换回计算器时,应用程序崩溃了,并出现以下错误:

2013-02-21 20:55:36.556 CTS Calculator[22637:c07] * Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'To Calculator'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.' * First throw call stack: (0x15a9012 0x12b6e7e 0x650f31 0x642b99 0x642c14 0x12ca705 0x1fe2c0 0x1fe258 0x2bf021 0x2bf57f 0x2be6e8 0x22dcef 0x22df02 0x20bd4a 0x1fd698 0x260bdf9 0x260bad0 0x151ebf5 0x151e962 0x154fbb6 0x154ef44 0x154ee1b 0x260a7e3 0x260a668 0x1faffc 0x1ecd 0x1df5) libc++abi.dylib: terminate called throwing an exception (lldb)



我不知道为什么我第一次按下计算器按钮时没有发生这种情况。我有一个返回菜单的自定义 segue 过渡,但不是从菜单到计算器。我相信我的导航 Controller 设置得很好。任何想法可能是什么问题?

最佳答案

错误显示您没有导航 Controller 。你正在设置 segue 风格来插入。将 segue 样式更改为 modal 并尝试一下。
是的。您可以使用 push那么 Root View Controller 应该是一个导航 Controller 。
检查这些链接
Adding a Navigation Controller to a Storyboard
Use Storyboards to Build Navigation Controller and Table View

关于ios - Push Segue 的奇怪错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15017191/

相关文章:

ios - 如何在我的 iOS swift listview Controller 中显示 firebase 信息?

ios - 使用数据内容播放视频而不保存

ios - 带有半径的 SKShapeNode 错误

ios - 为什么阴影半径也会对圆的内部产生影响?

ios - 停止以下 KeyFrameAnimation 时遇到问题 :

ios - 如何让一个 View Controller 从另一个 View Controller 访问变量?

ios - Xcode:从父项目继承 `configuration` s - 不可能吗?

苹果手机 : how to copy images to image group?

ios - 如何在 Parse 中重置 iOS 推送通知角标(Badge)编号?

objective-c - 使用 Objective C 访问 Sprite in Touch 事件