简体   繁体   中英

unwind to other viewController without using StoryBoard

I am use to performing unwinds to the easy what that is like this:

First set this on the destination view controller:

@IBAction func unwindToThisViewController(segue: UIStoryboardSegue) {}

Finally drag and drop and then pick the wanted unwind:

拖放

选择放松

But till Xcode updates to 8.2.1 if you have the destination view controller with some extensions it doesn't appear on the list (Manual Segue). I didn't update to 8.3 because I'm still using Swift 2.3 so I don't know in further versions this bug is solved.

Instead of having to move all the extensions in the same file, which it will be a chaos find anything there. I am wondering if there is any other way to perform this action without using the storyboard step.

I am currently using navigation controller, maybe popToViewController will do it? I don't know honestly.

Thank you very much for the help.

In the storyboard, give your unwind segue an identifier.

在此处输入图片说明

Then, in your code do:

performSegue(withIdentifier: "SegueID", sender: nil)

Source: https://spin.atomicobject.com/2014/12/01/program-ios-unwind-segue/

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