Re: UITapGestureRecognizer and state/action w/rt numberOfTapsRequired
Re: UITapGestureRecognizer and state/action w/rt numberOfTapsRequired
- Subject: Re: UITapGestureRecognizer and state/action w/rt numberOfTapsRequired
- From: Jeffrey Oleander <email@hidden>
- Date: Tue, 08 Nov 2011 13:14:37 -0800 (PST)
> From: Ben Kennedy <email@hidden>
> Subject: UITapGestureRecognizer and state/action w/rt numberOfTapsRequired
> To: "Cocoa-Dev List" <email@hidden>
> Date: Tuesday, 2011 November 8, 14:56
> From http://developer.apple.com/library/ios/#documentation/uikit/reference/UITapGestureRecognizer_Class/Reference/Reference.html
> :
>
>> Although taps are discrete gestures, they are discrete
>> for each state of the gesture recognizer; thus the
>> associated action message is sent when the gesture begins
>> and is sent for each intermediate state until (and
>> including) the ending state of the gesture. Code that
>> handles tap gestures should therefore test for the state of
>> the gesture, for example:
>>
>> - (void)handleTap:(UITapGestureRecognizer *)sender
> { if (sender.state ==
> UIGestureRecognizerStateEnded)
> { //
> handling code } }
>
> This suggests that if I set numberOfTapsRequired = 2, I
> should be able to get action for both a single tap (i.e. the
> first of a pair of taps), as well a double-tap.
> However, in iOS 5 this does not appear to be the case; my
> action method is not called until the numberOfTapsRequired
> has been satisfied.
>
> In order to respond to both a single and double tap, do I
> thus need to attach two gesture recognizers?
Go another layer more primitive:
http://www.oreillynet.com/pub/a/iphone/excerpts/iphone-programming-user/touch-patterns.html
http://iphonedevelopertips.com/user-interface/detect-single-tap-in-uiscrollview.html
http://developer.apple.com/library/ios/documentation/UIKit/Reference/UITouch_Class/Reference/Reference.html#//apple_ref/occ/instp/UITouch/tapCount
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden