简体   繁体   中英

Unwind to specific instance of ViewController

I have a ViewController that I'm just re-instantiating to navigate to another instance of it (there's a reason for this) with the following code:

let viewController = storyboard.instantiateViewControllerWithIdentifier("CompletionViewController") as! CompletionViewController
self.navigationController?.pushViewController(viewController, animated: true)

Everything works fine, except when I try to unwind... since every instance of the control has the unwind method:

@IBAction func unwindToThisViewController(segue: UIStoryboardSegue) {}

It ends up unwinding to the last instance of the VC instead of the first (which is what I want), for example:

vc1 > vc2 > vc3 > unwind from here

I want to unwind to "vc1", but it actually unwinds to "vc3".

Is there anyway that I can unwind to the first instance of the VC; or like in my example "vc1"?

in your CompletionViewController , there are 3 icons at the top of the view. if you CTRL drag from the left yellow icon to the right red one (the "exit") you can choose your unwinding segues. Now you can use that unwind in your code ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM