我想执行从 View B 到 View C 的 segue,我正在调用 class A 中的方法。 我在 B 类中的 segue 方法是-
//ViewController B
func nextViewAction() -> Void {
self.performSegueWithIdentifier("nextview", sender: self)
}
我在 A 类中这样调用它-
//ViewController A
@IBAction func sideMenuAction(sender: AnyObject) {
ViewClassB().nextViewAction()
}
但它崩溃了-由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'Receiver () 没有标识符'nextview'的segue'
最佳答案
您是否为 Controller B 和 Controller C 之间的转场设置了名称 nextview
?您可以通过单击两个 Controller 之间的 segue 进行检查,然后检查 Attributes Inspector 中的 Identifier 值。
关于swift - 如何从另一个类调用 perform segue 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43247366/