I've set up a UITableView with a double-tap UITapGestureRecognizer. But attempts to double-tap a cell by the user just launches didSelectRowAtIndexPath twice. Are these two supposed to work together?
(i'm aware i could use a single tap gesture recognizer in place of the built-in behavior of didSelectRowAtIndexPath, but here's the problem with that: the cell also has a button that I can't press anymore when i add the single tap gesture recognizer. Also, I've seen examples on SO of users building double tap functionality into didSelectRowAtIndexPath, but isn't that a bit too much of a hack?)
Best Answer
More info about Kris' answer:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIGestureRecognizer_Class/Reference/Reference.html
In my case I had a problem when adding 2 tap gestures to a
UIImageView
that was on a customUITableViewCell
. What happened was thedidSelectRowAtIndexPath:
was called when you tap/double tap on theUIImageView
. When I had only one tap gesture, thedidSelectRowAtIndexPath:
was not called (and for me, that was the right behavior.To prevent the
didSelectRowAtIndexPath:
from being called when using two tap gestures (single/double tap), I added this code to the first tap gesture (the single one):After this change, a tap/double on the
UIImageView
(on top of the custom cell) did not trigger thedidSelectRowAtIndexPath: