Mac开发-监听全局鼠标、键盘事件

2019-08-21  本文已影响0人  只爱随便看看
[NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown | NSEventMaskMouseMoved handler:^NSEvent* (NSEvent* event) {
        return event;
    }];
[NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown | NSEventTypeKeyDown | NSEventMaskMouseMoved handler:^(NSEvent * _Nonnull event) {
        [self globalMonitorEvent:event];
    }];
上一篇 下一篇

猜你喜欢

热点阅读