osx - Keep both NSSplitViewController's child controllers in first responder chain -


i've document based app nssplitviewcontroller main window's content view controller. left pane contains custom view controller, implements menu commands.

the right pane contains standard nstableview controller. when app starts menu commands work expected, inside right table view selected, menu commands disabled.

how can make sure view controller of left pane remains inside first responder chain?

i tried hooking menu commands directly correct view controller, ib not allow connections scene in storyboard. can connect objects in same scene.

regards,

remco poelstra

connect first responder.

you can have child view controllers respond actions implementing -[nsresponder supplementaltargetforaction:sender:] in nssplitviewcontroller subclass:

- (id)supplementaltargetforaction:(sel)action sender:(id)sender {     id target = [super supplementaltargetforaction:action sender:sender];      if (target != nil) {         return target;     }      (nsviewcontroller *childviewcontroller in self.childviewcontrollers) {         target = [nsapp targetforaction:action to:childviewcontroller from:sender];          if (![target respondstoselector:action]) {             target = [target supplementaltargetforaction:action sender:sender];         }          if ([target respondstoselector:action]) {             return target;         }     }      return nil; } 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -