Is it possible to handle touch events in the key UIWindow in the app Delegate or anywhere else?
Any help would be appreciated please.
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.
There is a handy catch-all method in
UIWindowcalledsendEvent:which sees every event near the start of the event-handling pipeline. If you want to do any non-standard additional event handling, this is a good place to put it. Something like this:Docs: UIWindow class reference | iOS event delivery docs
This blog post also mentions how to override
hitTest:withEvent:to catch some events before they’re bound to the target leaf subview in the view hierarchy. You can also override that method on yourUIWindowobject if you want.