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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.