Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the "First Responder" and "Exit" boxes purpose in the storyboard editor?

In the XCode IDE, at the bottom of the view controller in the MainStoryboard editor, are two boxes: First Responder, and Exit.

I know what a firstResponder is programatically within the code, but in the storyboard editor, I can't seem to do anything useful by it.

Am I able to use the first responder in this area to somehow set the first responder of the view? I'd like the first textfield to be active on load and I have tried right+click and dragging to no avail. I know I can set it programatically in the viewDidLoad method, but is there some way of doing it here?

And what is the green Exit for?

First Responder (orange) and Exit (Green) - what are they for?

like image 846
Madivad Avatar asked Nov 26 '12 12:11

Madivad


People also ask

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.

What is first responder in Xcode?

The first responder is usually the first object in a responder chain to receive an event or action message. In most cases, the first responder is a view object that the user selects or activates with the mouse or keyboard.


1 Answers

There are no good answer for this question, so I am posting my answer:

From here:

Note: You probably won’t be using the First Responder very much. This is a proxy object that refers to whatever object has first responder status at any given time. It was also present in your nibs and you probably never had a need to use it then either. As an example, you can hook up the Touch Up Inside event from a button to First Responder’s cut: selector. If at some point a text field has input focus then you can press that button to make the text field, which is now the first responder, cut its text to the pasteboard.

Edit:

1) First Responder is very useful if you are using text fields with keyboard notifications. I use it to make keyboard disappear, make an outlet to variable currentFirstResponder of your class, and in viewWillDisappear:

[self.currentFirstResponder resignFirstResponder]; 

2) You can read about unwind segues ("Exit" box) here

like image 114
Borzh Avatar answered Sep 30 '22 22:09

Borzh