Or, if in most cases your view of the controller is just a common container, insert your controller in the chain of responders between its view and its views. This can be done using these lines of code in your awakeFromNib: controller awakeFromNib:
Obj-C:
[self setNextResponder:self.view]; for (NSView *subview in self.view.subviews) { [subview setNextResponder:self]; }
Swift:
override func awakeFromNib() { super.awakeFromNib() self.nextResponder = self.view for subview in self.view.subviews { subview.nextResponder = self } }
No subclass required.
Guy moreillon
source share