Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从其他类执行Segue_Ios_Swift_Segue - Fatal编程技术网

Ios 从其他类执行Segue

Ios 从其他类执行Segue,ios,swift,segue,Ios,Swift,Segue,我想表演另一节课的音乐 class A { func createAccount(email:String,password:String) { if email != "" && password != "" { B().performSegueFromA(id: "Test") } } } class B: UIViewController { var a = A() @IBActio

我想表演另一节课的音乐

class A {
    func createAccount(email:String,password:String) {
        if email != "" && password != "" {
            B().performSegueFromA(id: "Test")
        }
    }
}

class B: UIViewController {
    var a = A()

    @IBAction func CreateAccountButton(_ sender: Any) {
        A.createAccount(email: newEmailField.text!, password: newPasswordField.text!)
    }

    func performSegueFromA(id:String) {
        self.performSegue(withIdentifier: id, sender: nil)
    }
}
我正在从类A调用
performsguefroma
方法。但是我得到了原因:

'接收器没有标识符为'Test'的序列'

我在
mainstoryboard
中设置了序列标识符


非常感谢您的帮助。

这取决于您如何实例化类
B
及其生命周期。@Ratursharker感谢您的评论,类B继承自UIViewController。类A是类B的模型。当
A
调用
performsgue
函数时,您如何实例化
B
&我已经更新了我的问题!我正在为我的创建帐户屏幕使用perform。我认为你的代码中有一个奇怪的循环。。。为什么要执行这样的实现?你认为在你的情况下,授权会更好吗?