Unwind segues are a great way to get from one view controller down the stack back up to another. However, implementing them is not so straight forward - I always forget myself, so I thought I'd share it here.
The key is to first add a method onto the view control to which you're segue-ing that takes in a UIStoryboardSegue. For example:
- (IBAction)unwindFromMarketplaceView:(UIStoryboardSegue *)segue;
Afterwards, head to Storyboard and ctrl+drag from the yellow Home icon on the top of the view your segueing from to its green Exit icon. This will create an unwind segue in Storyboard. Click that segue and give it an identifier.
To programmatically enact the segue - say when a button is touched, you can then call [self performSegueWithIdenfifier:(NSString)unwindSegueIdentifier sender:self] in the view controller that is being transitioned to.
This blog is licensed under Attribution-Noncommercial-Share Alike 3.0 Unported license.
comments powered by Disqus