Hi,
How can you detect single/double/triple taps in iPhone using Objective C?
Use the following code to detect single or multiple taps in iPhone/iPad/iPod.
The code can also be used with Cocos2D & Box2D.
-( void )touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *urtouch = [touches anyObject]; NSUInteger urtapCount = [urtouch tapCount]; switch (urtapCount) { case 1: NSLog(@ "Single Tap Detected!" ); break ; case 2: NSLog(@ "Double Tap Detected!" ); break ; case 3: NSLog(@ "Triple Tap Detected!" ); break ; default : break ; } } |
Try it out! You can even detect Quadrup!
Hi,
In this case you will get all 3 entries in the log for tripple click.
Need a better solution
Thanks,
Vlad