Search code examples
iphoneobjective-cxcodetouchesbegantouches

Possible to count the number of touches in iphone?


I want to count the number of touches in one second. So, if three touches were detected in one second do this, if 5 detected to that. I wanted to know if you can do that in touchesBegan.

All I want to do is execute different methods according to how fast the user touches the screen.

Thanks for your help.


Solution

  • I would suggest you use a UITapGestureRecognizer and then handle the taps accordingly depending on how many were detected. It is capable of detecting individual taps as well as how many fingers were set down.

    Here's the documentation on it:

    http://developer.apple.com/library/ios/#documentation/uikit/reference/UITapGestureRecognizer_Class/Reference/Reference.html