- (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; } } }
[view becomeFirstResponder]; or [window makeFirstResponder:view];