Cannot Connect Storyboard Unwind Segue Cannot Connect Storyboard Unwind Segue ios ios

Cannot Connect Storyboard Unwind Segue


You need to have an IBAction defined on a view controller that takes an argument of type "UIStoryboardSegue *".

Something like this:

@interface MyViewController...- (IBAction)unwindFromConfirmationForm:(UIStoryboardSegue *)segue {}...@end

Swift 3 Version

@IBAction func unwindToViewController(segue: UIStoryboardSegue) {    //code}

Provided by DoruChidean in https://stackoverflow.com/a/46199117/250190


Just to clarify, to link this up in storyboard, after adding the above method to the "view controller you want to unwind to" you need to drag a segue from a button or whatever in your "view controller you want to unwind from" down to it's own little green "EXIT" icon in the bottom bar.

There should be a popup to link to "- unwindFromConfirmationForm".

Once that's done, the unwind segue should work.


Just adding to Travis excellent point: to be utterly clear:

Say you've just started experimenting with storyboards so you (a) made a new iOS7 Xcode project and (b) made a story board with one navigation controller, and then (c) you've made five or six view controllers. You aim to be able to go-and-fore between the half-dozen view controllers using unwinds. {It is trivial to go "forward" by control-dragging from a button in one, to, the next one.}

Now, at this moment: all six of the view controllers, will indeed be the "default" class "ViewController". Note that Xcode (somewhat pointlessly) gives you a ViewController.h and ViewController.m file.

Again, all six of your "simple example" views are indeed just using that file ViewController.m, at this moment. So, very simply, if you add this:

-(IBAction)unwindUnused:(UIStoryboardSegue *)segue    {    NSLog(@"I did an unwind segway! Holy crap!");    }

To that one "stub" file ViewController.m - in fact, every one of your six views will now "work", you'll be able to drag to the infamous small green "Exit" button. It's that easy.

Now just TBC normally in a real project, you'd never use the default "ViewController.m" file. So, go here:

https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/SecondTutorial.html

and find down to precisely "Create Custom View Controllers", and it of course explains that process in excellent detail if you're new.

But again, if you're just fooling around and want to make the green button work for unwinds, simply put the code fragment in the "ViewController.m" stub file, and you're away. (Remembering that in "real life" you'd put a custom such call in each of your custom screens - likely dealing with data, etc etc.) Hope it helps!!

Bonus factoid: Note that a "Back" button will, anyway, automatically appear on the navbar when you're just testing like this! (i.e., even if you don't add the unwind stub method.)


Upvote for Jon Hess!This is the swift 3 equivalent

@IBAction func unwindToViewController(segue: UIStoryboardSegue) {    //code}