Where can I find a list of key codes for use with Cocoa's NSEvent class?

前端 未结 5 1461
无人及你
无人及你 2020-12-24 11:14

I\'m looking for a comprehensive list of the available key codes that can be used with Cocoa\'s NSEvent class. The NSEvent class has a keyCod

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 11:37

    For Swift, import Carbon.HIToolbox.Events and then use the constants directly:

    import Carbon.HIToolbox.Events
    
    let keyCode = kVK_ANSI_A
    

    For a list of all codes, go to the definition of Carbon.HIToolbox.Events:

提交回复
热议问题