当它直接从UIViewController到UITableViewController时,我的segue工作正常,但是当我将第二个视图嵌入导航控制器时,segue似乎不再起作用,并且unexpectedly found nil while unwrapping optional
出现错误。我不认为我需要更改代码。我应该以某种方式重建应用程序吗?我已经读到有关Xcode 6 beta中的错误(尽管我使用的是6.1),这些错误会导致开发人员构建应用程序的顺序生效。
因为您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
}
}
我希望这项工作
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句