CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Custom |
ReleasedLast Release | Dec 2014 |
Maintained by shiweifu.
摘录一段注册全局快捷键的代码(使用了Carbon):
@implementation HotKey
OSStatus HotKeyHandler(EventHandlerCallRef nextHandler, EventRef theEvent, void *userData) { AppDelegate *delegate = [[NSApplication sharedApplication]delegate]; [delegate displayMenu]; return noErr; }
(void) register { EventHotKeyRef gMyHotKeyRef; EventHotKeyID gMyHotKeyID; EventTypeSpec eventType; eventType.eventClass = kEventClassKeyboard; eventType.eventKind = kEventHotKeyPressed;
InstallApplicationEventHandler(&HotKeyHandler, 1, &eventType, NULL, NULL);
gMyHotKeyID.signature='htk1'; gMyHotKeyID.id=1;
RegisterEventHotKey(kVK_ANSI_M, cmdKey+shiftKey, gMyHotKeyID, GetApplicationEventTarget(), 0, &gMyHotKeyRef); }
@end
DDHotKey 的github 地址:https://github.com/davedelong/DDHotKey