On Tue, 13 Sep 2011 15:01:31 +0300, Motti Shneor <[email protected]> said:
>
>I need to insert some controllers I have into the responder chain, in such a 
>place that their functionality (IBActions and menu validation) will be 
>available regardless of specific view focus, etc.

I do this sort of thing all the time, typically at the level just above the 
window:

  id nr = [window nextResponder];
  [window setNextResponder:myResponder];
  [myResponder setNextResponder: nr];

(Last line perhaps otiose but better safe than sorry.) 

Here's another example, where the goal is to do menu item validation / response 
in a table view:

  NSResponder* r = [[myTableView enclosingScrollView] nextResponder];
  [[myTableView enclosingScrollView] setNextResponder: self];
  [self setNextResponder: r];

Typical use case is that I want to handle key events (e.g. flagsChanged:, 
keydown:) and/or deal with menus. I've been doing this for years and nothing 
bad has happened. m.

--
matt neuburg, phd = [email protected], <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to