我在主视图 Controller 中有一个带有单元格的拆分 Controller 。当我点击特定的单元格时,我希望细节 View Controller 切换到 Storyboard上的特定 View Controller 。
我尝试连接两个 View Controller (主视图 Controller 到新 View Controller ),为新 Controller 提供 Storyboard ID“NewDetailSegue”并尝试以下代码:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if (indexPath.row == 0) {
self.performSegueWithIdentifier("NewDetailSegue", sender: self)
}
但是它根本不工作并且崩溃了。如何让详细 View Controller 转至新的 View Controller ?
这里是错误:
2015-04-10 22:06:44.180 velcro[3616:174510] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<velcro.MainReportController: 0x7feeb95881b0>) has no segue with identifier 'NewDetailSegue'
最佳答案
gave the new controller a storyboard ID "NewDetailSegue"
但是 segue 需要标识符“NewDetailSegue”——而不是 View Controller 。我敢打赌,当您将标识符附加到 Storyboard中的 segue 时,您的崩溃就会消失。
关于ios - Xcode Swift - 如何从拆分 Controller 转到特定的导航 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29573654/