Re: patching the responder chain: puzzled by the docs
Re: patching the responder chain: puzzled by the docs
- Subject: Re: patching the responder chain: puzzled by the docs
- From: Andy Lee <email@hidden>
- Date: Mon, 25 Jan 2010 17:01:31 -0500
I went ahead and created rdar://7576845 rather than use the documentation feedback form, because I'd like to see what the answer is.
--Andy
On Friday, January 22, 2010, at 12:42PM, "Andy Lee" <email@hidden> wrote:
>My understanding was that it's okay to insert things anywhere you want in the responder chain. In particular, it's okay to put a a view controller between its view and the view's superview. I know I'm not alone in this:
>
> * Buck and Yacktman say so in "Cocoa Design Patterns," in the section "Inserting Objects into the Responder Chain."
> * Jonathan Dann offered a way for view controllers to get patched in automatically, and nobody said boo: <http://www.cocoabuilder.com/archive/cocoa/212830-responder-chain-patching.html#212954>.
> * In the same thread, Matt Neuberg (no slouch) said he does it all the time, though with a custom NSResponder rather than a view controller: <http://www.cocoabuilder.com/archive/cocoa/212830-responder-chain-patching.html?q=Responder+Chain+Patching#212862>.
> * On the iPhone, UIKit's responder chain is structured this way by default.
>
>But today I noticed this:
>
><http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html>
>"A view’s next responder is always its superview—most of the responder chain, in fact, comprises the views from a window’s first responder up to its content view. When you create a window or add subviews to existing views, either programmatically or in Interface Builder, the Application Kit automatically hooks up the next responders in the responder chain. The addSubview: method of NSView automatically sets the receiver as the new subview’s superview. You should never send setNextResponder: to an NSView object."
>
>Because of what addSubview: does, I can see you have to be careful *when* you send setNextResponder: to a NSView. But *never*? Are the docs wrong? Or is this a real Apple rule that people commonly violate at their own risk, like the rule about not starting method names with underscores? If so, what is that risk?
>
>--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden