开发者

Touch events, not limited to a specific view

开发者 https://www.devze.com 2023-01-13 18:53 出处:网络
How can I use touch events not limited to a specific view? I want to use those events for an background app and found out that I only can enable touch events for a view 开发者_如何学Cby usingsetAccept

How can I use touch events not limited to a specific view? I want to use those events for an background app and found out that I only can enable touch events for a view 开发者_如何学Cby using setAcceptsTouchEvents:

Thanks in advance, Philip


You could try overriding the application's sendEvent: method, but I doubt that will work, as it's for events within your own application. For an application that's always in the background, you won't get any such events.

The usual solution would be to install a CGEventTap, but since Quartz Event Services doesn't have event constants for touches, swipes, etc., I don't think you can do that.

The only other way I can think of might be to go through I/O Kit's HID layer; I have no idea specifically what you'll have to do to use that.

You probably should file an enhancement request in RadarWeb to ask for a higher-level solution (such as touch event support in CGEventTap).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号