playerken

博客园 首页 新随笔 联系 订阅 管理

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.

posted on 2014-11-27 17:38  playerken  阅读(394)  评论(0编辑  收藏  举报