Querying current number of touches on screen without using events on iPhone

Posted by nikhil on Stack Overflow See other posts from Stack Overflow or by nikhil
Published on 2010-04-18T12:31:14Z Indexed on 2010/04/18 12:33 UTC
Read the original article Hit count: 333

I have an application that starts playing a sound when user touches the uiview and changing to different tones as the user slides the finger on the screen. The sound stops when the user lifts the finger.

I am using the touchesBegan, Moved and Ended Events for this.

My problem is touches Ended (and/or cancelled) is sometimes not fired properly and the sound keeps playing even after the finger is lifted from screen.

So as a workaround I would like to implement a timer that would check for the number of touches on the screen and if it is zero it will check and stop the audioplayer if playing.

I have been searching for some code that could get me the number of touches like

UITouch *touches=[self getAllTouchesonScreen];

or something :)

© Stack Overflow or respective owner

Related posts about iphone

Related posts about touches-canceled