What is this resignFirstResponder business? Here is the short version:
Some view objects are also controls. A control is a view that the user can interact with. Buttons,
sliders, and text fields are examples of controls. (Keep in mind that the term “control” has nothing to
do with “controllers” in MVC.)
When there are controls on the screen, one of them can be the first responder. When a control has first
responder status, it gets the first chance to handle text input from the keyboard and shake events (such
as when the user shakes the device to undo the last action).
When the user interacts with a control that can accept first responder status, that control is sent the
becomeFirstResponder message. When a control that accepts text input (like a text field) becomes the
first responder, the keyboard appears on the screen. At the end of addTask:, you tell the text field to
resign its status, which causes the keyboard to disappear.
相关文章
- 01-30resignFirstResponder