Improving the Storyboard: Take 2

iOS 6 introduced a better way to return data to the view controller that initiated the segue: You simply add a special type of IBAction to your view controller. Usually an action method has an argument that looks like (id)sender, or it has no argument at all. By changing the argument to (UIStoryboard*)segue, you create a special type of action, one that can accept segues.

As you saw earlier in this chapter, prepareForSegue:sender: is sent only when one scene initiates a transition to another. It is a forward segue. This other kind of action is the opposite: It is sent when a scene wants to go back to the previous one. It unwinds the segue that first opened the scene, and it opens the previous scene without creating ...

Get Learning iOS Development: A Hands-on Guide to the Fundamentals of iOS Programming now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.