Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top