views:

610

answers:

2

I am relatively new to IPhone coding, although I have reached the point of working on a genuine (hopefully) saleable app.

But one thing that is still mysterious is the responder chain. All the books give passing reference to it, but I have not found one yet that describes how to modify that chain. Another curiosity is that, when the First Responder icon is clicked in the IB, a little hookup box comes up with all sorts of choices to hook up to something, but I've never found any explanation of that.

Does anyone know of an in-depth explanation of this responder process?

Thanks in advance for any help.

John Doner

+1  A: 

Here's Jeff Lamarches explanation of the responder chain. While not at all exhaustive, it should get you thinking on the right track.

ennuikiller
+1  A: 

The responder chain is the order in which various objects are given the chance to handle an event. In a simple case, suppose we have a button in a UIView in a NSWindow in a NSApp. When the button is clicked; the button will have the first opportunity to handle the event, then its controller, then the UIView, then its controller, then the NSWindow, then its delegate, then the NSApp and its delegate. In this way, an object is first given a chance to handle the event, then its controller/delegate, then the container of the object and so on. There are other cases that are much more complicated.

An object handles an event by implementing -(void)respondToFictionalEvent:(UIEvent *)event. If this happens, then the event is "consumed" (prevented from being automatically passed further up the chain).

Casebash
Actually, I'm not sure if the button has a chance to respond or if the first responder is the super view.
Casebash