使用主屏幕快速操作,我的快速操作深层链接到导航堆栈中的第3个VC。我可以通过下面的方式进入第二个VC,但是我需要触发另一个performSegueWithIdentifer ...是否可以,因为我没有引用它来调用它?
case ShortCutIdentifier.Second.type:
handled = true
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let navVC = storyboard.instantiateViewControllerWithIdentifier("peopleNavController") as! UINavigationController
let peopleTVC = navVC.topViewController as! PeopleTableViewController
self.window?.rootViewController?.presentViewController(navVC, animated: true, completion: nil)
peopleTVC.performSegueWithIdentifier("showStoresSegue", sender: peopleTVC)
//I want to perform segue again here but from what object?
答案 0 :(得分:2)
这是一个示例解决方案,可以在第一个之后执行第二个segue。
在第一个视图控制器中,添加以下内容:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "showStoresSegue" {
segue.destinationViewController.someSegueShouldHappen = true
}
}
然后,在第二个视图控制器中,添加:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear()
if someSegueShouldHappen {
yourSecondViewController.performSegueWithIdentifier(“The Second Segue”, sender: self)
someSegueShouldHappen = false
}
}
您需要在第二个视图控制器上添加名为someSegueShouldHappen
的属性或您选择的名称,如
var someSegueShouldHappen: Bool = false