Reputation: 199
How can I dismiss a NSViewController when a subview NSButton is clicked?
I can't access to NSViewController from function of NSButton mouseDown so I can't write a code similar to:
self.viewController.dismissController(self)
I need to set this programmatically, the same result when you connect via Assistant Editor a NSButton Action to its owner ViewController.
Upvotes: 1
Views: 776
Reputation: 889
You can manually set the target and action on controls in code.
In your view controller:
self.button.target = self;
self.button.action = @selector(dismissController:);
Should be good to go.
Upvotes: 1