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
图标,而不是从按钮连接展开序列
请参阅此答案的第二部分,了解如何将其连接到故事板中:
像调用任何其他序列一样调用展开序列。