Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的应用程序中,我想保留一个时间戳,每次触发鼠标或按键事件时都会更新。如何在我的应用程序中检测到这些事件?
非常感谢!
查看NSEvent方法addGlobalMonitorForEventsMatchingMask:handler:和addLocalMonitorForEventsMatchingMask:handler:(取决于您是要在自己的应用程序还是其他应用程序中跟踪事件)。
NSEvent
addGlobalMonitorForEventsMatchingMask:handler:
addLocalMonitorForEventsMatchingMask:handler: