ios - 转至 Storyboard Reference 后出错

标签 ios objective-c iphone swift uistoryboardsegue

我从一个用 Objective C 编写 View Controller 的 Storyboard 转到另一个用 Swift 2 编写 View Controller 的 Storyboard,一切顺利。

但是,当我在第二个 Storyboard 中单击 fire the next segue 时,出现以下错误:

*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'record'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

这是在 Swift 2 中调用下一个 segue 的代码

self.performSegueWithIdentifier("record", sender: nil)

第二个 Storyboard 中的初始 View 也嵌入到导航 Controller 中。

同样值得注意的是,我尝试不使用第一个 Storyboard,我的应用程序直接转到第二个 Storyboard,它发现 segue 很好。

关于可能导致问题的任何想法?

最佳答案

选择 segue,转到其 Attributes inspector 并将 Kind 从 push 更改为 Modal。让演示文稿和过渡保持默认。

enter image description here

这很适合你。

但是如果您想要“Push”类型的 segue,那么第一个用 Objective-C 编写的 View controller 应该嵌入到 Navigation Controller 中。

关于ios - 转至 Storyboard Reference 后出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35225142/

相关文章:

iphone - 为什么 UIViewController 的 View 属性会在每次访问时增加 retainCount?

iphone - 为 ipad 复制 xib 后 GUI 不正确?

android - 有没有办法在 Android 中定义协议(protocol)类?

ios - ld : framework not found MCCMerchant_sandbox

ios - Swift - TableView 加载错误 - 可怕的 SIGBART

python - Twilio session 主持人和参与者姓名

ios - 错误域 = com.apple.healthkit = 3 "Workout Session is Not Current"错误?

objective-c - UiBarButtonItem 与 "Done"按钮颜色相同

iphone - Return 语句创建和释放一个对象

iphone - 在 ARC 上使用 SCRFTPRequest 进行 iOS FTP 上传