Re: NSView - trouble setting next responder on 10.10 - works okay on 10.9
Re: NSView - trouble setting next responder on 10.10 - works okay on 10.9
- Subject: Re: NSView - trouble setting next responder on 10.10 - works okay on 10.9
- From: Conrad Shultz <email@hidden>
- Date: Fri, 02 Oct 2015 10:35:19 -0700
> On Sep 30, 2015, at 9:15 AM, Jonathan Mitchell <email@hidden> wrote:
>
> In my app i manage the responder chain on 10.8 and 10.9 to insert the NSViewController into the responder chain.
> The view controllers are inserted just below the NSWindowController so that designated view controllers can respond to actions coming up the chain from any source.
> ie: the NSViewController for any view will NOT be the view’s next responder - it will be higher up in the chain.
>
> On 10.10 the view controller is automatically assigned to be the view’s next responder.
> I want to override this behaviour to not assign the controller as the view’s next responder.
> I thought this would be trivial but once the NSView nextResponder has been set to the controller the view seems reluctant to have its next responder changed.
> The next responder remains set to the view controller;
Starting with 10.10, -[NSView setNextResponder:] forwards to the view controller, which is what you are seeing.
From the AppKit Release Notes <https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#10_10ViewController>:
NSViewController automatically adds itself into the responder chain... When the view has a call to setNextResponder: made, the method will be forwarded to the view’s view controller. If you currently are already doing your own responder chain management, take particular care as the view.nextResponder may already be the NSViewController. This can cause an issue for apps that manually set the viewController.nextResponder = view.nextResponder, without checking to see if the view.nextResponder != viewController...
It sounds like in your case you may want to implement responder methods higher up in the chain that, when appropriate, dispatch messages to the view controller(s), but this of course will depend on your architecture and what exactly you are trying to do.
-Conrad
_______________________________________________
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