How to catch losing focused event in iOS application?
-
14-06-2021 - |
質問
My application receives and process all touch events, received through UIWindow object. So, for every touch event I create a record and at any moment I can check how much fingers on the screen... Everething worked fine until I tried to use system gestures (switch between tasks, call task manager)... In this case i received all four touchesBegan events, but not tochesEnded. In other words my application doesn't receive any touch events if they are become system gestures.
The question is: How can I catch ALL touch events?
Thank You!
解決
The trick is to handle correctly touchesCancelled:withEvent: which is fired when the application lose focus on multitasking gesture.
他のヒント
I think I got the answer: So, I think it's impossible or incorrect to catch any touch event after application will resign its focuse. So, I just need to handle applicationWillResignActive and applicationDidBecomeActive events to catch and process my issue... In other words, I have to delete all my touch entries when my application loses the focuse.