This is an old revision of the document!
Handling Key Events
- any subclass of NSResponder can accept events
- subclass NSWindow, with MyWindow
- in IB, set the window to use the custom class, MyWindow
- override the following method in MyWindow:
- (void)keyDown:(NSEvent *)event { switch ([event keyCode]) { case 121:{ // page down if([event modifierFlags] & NSCommandKeyMask) // only do something if the command key was also pressed // do something break; } } }