Search code examples
interface-builderios6uistoryboarduistoryboardseguexcode4.5

Does anyone know what the new Exit icon is used for when editing storyboards using Xcode 4.5?


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?


Solution

  • 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).