I am trying to detect double taps on a view, but when the double tap comes, the first tap triggers an action on TouchesBegan, so, before detecting a double tap a single tap is always detected first.
How can I make this in a way that just detects the double tap?
I cannot use OS 3.x gestures, because I have to make it compatible with old OS versions.
thanks
Edit: I missed the point that you said you cannot use 3.x gestures, so this is an invalid answer to your question, but I'm leaving it in case someone who can use 3.x gestures may benefit from it.
You can create two gesture recognizers, one for single tap and one for double tap:
And then, here comes the punch:
The last line, makes your single tap handler work only if the double tap fails. So, you get both single tap and double tap in your application.
Some excerpts from the tapZoom example of the scrollViewSuite sample code:
First, the function to kick off things once the touch ended:
Second: intercept the message if a new touch occurs during timeout:
see also: http://developer.apple.com/iphone/library/documentation/WindowsViews/Conceptual/UIScrollView_pg/ZoomingByTouch/ZoomingByTouch.html#//apple_ref/doc/uid/TP40008179-CH4-SW1
and here: (scrollView suite) http://developer.apple.com/iphone/library/samplecode/ScrollViewSuite/Introduction/Intro.html
Are you looking at the tapCount? For example: