Right-clicking the Exit icon yields an empty window. Can't Ctrl-drag a connection to any IB elements or corresponding source files. Docs give no love. Doesn't appear in nib files, only storyboards. My assumption is that it's a corollary to segues, but I don't see any new methods to back it up. Anyone?
-
Dupe : http://stackoverflow.com/questions/12416050/xcode-4-5-storyboard-exit ? – chwi Oct 25 '12 at 13:39
-
Possible duplicate of [Xcode 4.5 Storyboard 'Exit'](https://stackoverflow.com/questions/12416050/xcode-4-5-storyboard-exit) – Tamás Sengel Oct 08 '18 at 16:02
3 Answers
I had a hard time following the accepted answer so here is more detail.
Given the photo below on view controller C you can "exit" back to any view controller in the segue path.
ViewController A you can write:
- (IBAction)done:(UIStoryboardSegue *)segue {
// Optional place to read data from closing controller
}
ViewController B you can write:
- (IBAction)back:(UIStoryboardSegue *)segue {
// Optional place to read data from closing controller
}
ViewController C you control drag from "back" button to the green exit option and select back:
ViewController C you control drag from "done" button to the green exit option and select done:
Note: Even though the methods are on other view controllers they show up for the ViewController C's exit. Control dragging and selecting a method defines which ViewController to unwind to.

- 7,787
- 5
- 19
- 34
-
2One more note: sometimes green exit button not being active even all steps are done. In this case reopening storyboard (or xcode project) makes it work as expected. – zxcat Jul 27 '13 at 09:06
-
3Another issue I had was that I didn't put my unwind segue method signature in my .h file or class extension. After I added it the unwind segue showed up in the popup. – Steve Moser Sep 06 '13 at 15:02
-
2+Infinity for `Even though the methods are on other view controllers they show up for the ViewController C's exit.` – Andrew Nov 26 '14 at 22:36
There's a lot of information in the WWDC video "Session 407 - Adopting Storyboards in your App."
Say you have two view controllers linked by a segue. Implement the following exit action on the first view controller:
- (IBAction)done:(UIStoryboardSegue *)segue {
NSLog(@"Popping back to this view controller!");
// reset UI elements etc here
}
Then, on Storyboard scene for the second view controller, Ctrl-drag from a UI element, such as a button, to the exit icon at the bottom of this view controller. The done:
action you added to the code of the first controller will appear as an option. Now, activating the button you Ctrl-dragged to the exit icon will pop back to the first view controller and maintain its original state (ie UI elements such as text input supposedly still intact).

- 36,185
- 26
- 116
- 160

- 2,524
- 6
- 32
- 42
-
3It actually unwinds back to the exact same instance of the view controller (and its views). – Jon Hess Sep 25 '12 at 07:39
-
Thanks, I was reading this just to learn what the "Green Exit" was about, only to find out it resolve a problem for me. I had 2 view controllers separated by a TabBar controller and a navigation controller, and "Pop" didn't work to return backwards. This took 2 minutes and everything worked as you said! THANKS! – user589642 Dec 25 '12 at 20:26
-
How can I invoke action method on `Done` button in class of view B before exiting back to view A ? – expert Aug 30 '13 at 09:35
-
If you watch the WWDC video you can skip to 37:15 to see the part about "unwind segues" – moliveira Sep 02 '15 at 02:37