Search code examples
swiftcocoaxcode-storyboardfirst-respondernsmenuitem

Is it possible to insert NSObjectController to responder chain?


I've created an instance of NSObjectController (MenuObject on the image below) and method(test5:) for item's action there.

NSMenuItem is gray when I create a connection to First responder. And it works fine when I create a IBAction directly.

I think it's because my NSObjectController(MenuObject) doesn't part of responder chain. No one can responds to selector and that's why item is grey. But how to fix it?

Thanks.

NSMenuItem's action connected to First Responder


Solution

  • NSObjectController is a data-flow controller. Putting it in the responder chain does not make real sense.

    However, you should read about the responder-chain for action messages. Doing so, you will prefer to put the action method into a window controller.