Im繼承NSTextView並覆蓋keyDown。我想檢測命令鍵組合。例如,Command-L。檢查keyDown event.modifierFlags會產生錯誤
Apple's documentation表明您只需和的修飾符標誌(在通過NSEvent)與NSEventModifierFlags.CommandKeyMask。
當我這樣做:
let ck = NSEventModifierFlags.CommandKeyMask
我收到一個奇怪的錯誤:
Binary operator '&' cannot be applied to two 'NSEventModifierFlags' operands.
這是怎麼回事?這是迅速的2.0,xcode 7.
謝謝!
@LeoDabus更新回答。 – Darren