Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 972
rsswtmr Avatar asked Sep 24 '12 16:09

rsswtmr


People also ask

How do I change the storyboard entry point in Xcode?

If you should loose your entry point in your Storyboard or simply wish to change the entry point you can specify this in Interface Builder. To set a new entry point you must first decide which ViewController will act as the new entry point and in the Attribute Inspector select the Initial Scene checkbox.

What is first responder in storyboard?

First Responder: The First Responder icon stands for the object that the user is currently interacting with. When a user works with an iOS application, multiple objects could potentially respond to the various gestures or keystrokes that the user creates.

How do I open the main storyboard in Xcode?

To get this, open the storyboard, click the 'assistant' editor, click the 'assistant editor menu button' (immediately to the right of the > arrow at the top left of the assistant window) and select Preview.

What are storyboards in Xcode?

Storyboarding is a feature built into Xcode that allows both the various screens that comprise an iOS application and the navigation path through those screens to be visually assembled.


2 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.

enter image description here

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: enter image description here

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.

like image 97
Eric Avatar answered Dec 06 '22 04:12

Eric


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

like image 36
N S Avatar answered Dec 06 '22 03:12

N S