Reputation: 11178
I 've an annoying problem.
I' m adding a gesture recognizer:
UITapGestureRecognizer* tapGesture =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(DoubleClick:)];
tapGesture.numberOfTapsRequired = 2;
[self.view addGestureRecognizer:tapGesture];
This works, but when I single click any control that is on my view, the "releasing" is slow. I.e. a UIButton is released more slowly than normally. The same happens for all my controls inside the UIView. The touchesEnded: function is called with a delay.
When I use tapGesture.numberOfTapsRequired = 1, it works fine. However I want double click, not single click.
Please advise. Thx.
Upvotes: 0
Views: 671
Reputation: 23233
When tap and let go once, how do you know if it's a single tap or just the first half of a double tap?
Answer: You wait. If the second tap comes, it was a double tap. If a certain amount of time passes and no second tap happened, then it was a single tap. Check out delaysTouchesEnded
on UIGestureRecognizer
for more information on it.
I get around this issue by creating gesture which won't conflict with each other. A "two finger tap" and a "one finger tap" won't cause a delay, because you'll know how many finger were used before the gesture ends.
Upvotes: 2