March 2013
Intermediate to advanced
1000 pages
34h 51m
English
Let’s now return to the very beginning of the touch reporting process, when the system sends the app a UIEvent containing touches, and tease apart in full detail the entire procedure by which a touch is delivered to views and gesture recognizers:
hitTest:withEvent: on the window, which returns the view (called, appropriately, the hit-test view) that will be permanently associated with this touch. This method uses the UIView instance method pointInside:withEvent: along with hitTest:withEvent: recursively down the view hierarchy to find the frontmost view containing the touch’s location and capable of receiving a touch. The logic of how a view’s userInteractionEnabled, hidden, and opacity affect its touchability is implemented at this stage.
Each time the touch situation changes, the application calls its own sendEvent:, which in turn calls the window’s sendEvent:. The window delivers each of an event’s touches by calling the appropriate touches... method(s), as follows:
multipleTouchEnabled and exclusiveTouch is also implemented at this stage. For example, additional touches won’t be delivered to a view if that view currently has a touch and has multipleTouchEnabled set to NO.
If a gesture is recognized ...
Read now
Unlock full access