Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.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/20.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 有条件展开序列_Ios_Swift_Segue - Fatal编程技术网

Ios 有条件展开序列

Ios 有条件展开序列,ios,swift,segue,Ios,Swift,Segue,当用户点击我的按钮时,我希望有一个类似于以下内容的控制流: @IBAction func confirmPurchase(sender: AnyObject) { if blue == true { let mainTabController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("MainTabBarController") s

当用户点击我的按钮时,我希望有一个类似于以下内容的控制流:

@IBAction func confirmPurchase(sender: AnyObject) {

    if blue == true {
        let mainTabController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("MainTabBarController")
        self.presentViewController(mainTabController, animated: true, completion: nil)
    } else {
        perform an unwind segue
    }
}
我正在寻找在代码中调用unwind segue的方法。这是如何实现的?

您可以使用
performsguewithidentifier

您可以将其从视图控制器顶部的
viewController
图标连接到
exit
图标,而不是从按钮连接展开序列

请参阅此答案的第二部分,了解如何将其连接到故事板中:


像调用任何其他序列一样调用展开序列。