Recognize if user has pressed arrow key while editing NSTextField swift
问题 I have many NSTextFields and I want to know, if the user has pressed one of the arrow keys while editing one of them. The function override func keyDown(theEvent: NSEvent) { switch theEvent.character { case NSRightArrowFunctionKey: println(1) moveGor(NSRightArrowFunctionKey) case NSLeftArrowFunctionKey: moveGor(NSLeftArrowFunctionKey) case NSUpArrowFunctionKey: moveVert(NSUpArrowFunctionKey) case NSDownArrowFunctionKey: moveVert(NSDownArrowFunctionKey) default: super.keyDown(theEvent) } }