How to catch losing focused event in iOS application?

2k views Asked by At

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!

2

There are 2 answers

0
sigman On BEST ANSWER

The trick is to handle correctly touchesCancelled:withEvent: which is fired when the application lose focus on multitasking gesture.

0
Tutankhamen On

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.