cocoa touch - Use of first responders and first responder vs. target-action -


i understand use , need of target-actions. encountered concept of "first responder". can explain why needed? can can't done using target-actions?

in app, responder object first receives many kinds of events known first responder. receives key events, motion events, , action messages, among others. (mouse events , multitouch events first go view under mouse pointer or finger; view might or might not first responder.) first responder typically view in window app deems best suited handling event. receive event, responder must indicate willingness become first responder; in different ways each platform

when design app, it’s want respond events dynamically. example, touch can occur in many different objects onscreen, , have decide object want respond given event , understand how object receives event.

when user-generated event occurs, uikit creates event object containing information needed process event. places event object in active app’s event queue. touch events, object set of touches packaged in uievent object. motion events, event object varies depending on framework use , type of motion event interested in.

an event travels along specific path until delivered object can handle it. first, singleton uiapplication object takes event top of queue , dispatches handling. typically, sends event app’s key window object, passes event initial object handling. initial object depends on type of event.

touch events. touch events, window object first tries deliver event view touch occurred. view known hit-test view. process of finding hit-test view called hit-testing, described in “hit-testing returns view touch occurred.” doc.

for motion , remote control events. these events, window object sends shaking-motion or remote control event first responder handling. first responder described in “the responder chain made of responder objects.”

the ultimate goal of these event paths find object can handle , respond event. therefore, uikit first sends event object best suited handle event. touch events, object hit-test view, , other events, object first responder.

for more info, here...


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -