Changes

Jump to: navigation, search

An Overview of iPhone Multitouch, Taps and Gestures

1 byte added, 20:46, 20 January 2011
no edit summary
== The Responder Chain ==
In the chapter entitled Understanding iPhone Views, Windows and the View Hierarchy we spent some time talking about the view hierarchy of an appliation’s application’s user interface and how that hierarchy also defined part of the application’s responder chain. In order to fully understand the concepts behind the handling of touch screen gestures it is first necessary to spend a little more time learning about the responder chain.
When the user interacts with the touch screen of an iPhone the hardware detects the physical contact and notifies the operating system. The operating system subsequently creates an event associated with the interaction and passes it into the application’s event queue where it is subsequently picked up the event loop and passed to the current first responder object; the first responder being the object with which the user was interacting when this event was triggered (for example a UIButton or UIView object). If the first responder has been programmed to handle the type of event received it does so (for example a button may have an action defined to call a particular method when it receives a touch event). Having handled the event, the responder then has the option of discarding that event, or passing it up to the next responder in the response chain (defined by the object’s nextResponder property) for further processing, and so on up the chain. If the first responder is not able to handle the event it will also pass it to the next responder in the chain and so on until it either reaches a responder that handles the event or it reaches the end of the chain (the UIApplication object) where it will either be handled or discarded.

Navigation menu