> On Jun 30, 2018, at 3:46 AM, Rick Mann <rm...@latencyzero.com> wrote:
> 
> I have a complex view hierarchy with a lot of controllers. I'd like to 
> provide menu commands that the various controllers can respond to, but I have 
> a couple of problems:
> 
> 1) I can't seem to get any of my view controllers (even the window's root 
> view controller) to participate, even if I override acceptsFirstResponder to 
> return true.
> 2) What happens when I have sibling view controllers (e.g. in a split view 
> controller)? I'd like all of them to participate, if they can.
> 
> I can, of course, push all that stuff up to the root view controller, but 
> that makes me do things like subclass NSSplitViewController.
> 
> The whole thing seems cumbersome, at best. What am I missing?
> 
> Thanks,
> 
> -- 
> Rick Mann


I have an app with lots of views and a ton of custom controllers. If one of the 
controllers is not in the responder chain but needs to be this is what I do.

@property (readonly, retain) MyResponder *responder;

// During initialization of my view which is already in the responder chain
// insert custom object into the responder chain. Refer to Cocoa Event
// Handling Guide, Event Architecture, The Responder Chain.
MyResponder *customObject = _responder;
NSResponder *nextResponder = self.nextResponder;
[self setNextResponder:customObject];
[customObject setNextResponder:nextResponder];

--Richard Charles

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to