2011年4月9日 星期六

responder chain in iOS & Cocoa

events are passed through responder chain

ex:
if first responder is view A
when view A does not handle event, it forward event to next responder, its view controller
if view controller  does not handle event, it forward event to view A's parent view B
if view B does not handle event, it forward event to its view controller
Hence,  sequence is
view A ->  view A's view controller -> view A's parent view B -> view A's parent view B's view controller
note:
if event is passed through all view hierarchy, it is then passed to app's window. If window does not handle event, it is passed to UIApplication object

forward an event:
ex:
[self.nextResponder processEvent:event];

沒有留言:

張貼留言