我有一个直接从UIViewController到UITableViewController的segue工作正常但是当我在导航控制器中嵌入第二个视图时,segue似乎不再起作用,我得到unexpectedly found nil while unwrapping optional
错误。我不相信我需要更改代码。我应该以某种方式重建应用程序吗?我已经阅读了Xcode 6 beta中的错误(虽然我使用的是6.1),导致开发人员构建应用程序的顺序产生影响。
答案 0 :(得分:0)
因为你的segue的目的地不是NavigationController。您必须首先将控制器设置为NavagationController。
试试此代码
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "showItemSegue") {
let controller: Your_TableViewController = (segue.destinationViewController as UINavigationController).topViewController as Your_TableViewController
}
}
我希望这项工作