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 by using setAcceptsTouchEvents:
Thanks in advance,
Philip
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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).