Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITapGestureRecognizer waiting for second tap, buttons slow

I have a UITapGestureRecognizer waiting for a doubletap to zoom out an scrollview back to the original level. However there is a situation that I add a couple of buttons on top of the scrollview. These buttons react very slow (sluggishly) because once I tap a button, the app waiting for the second tap. If this does not come, the button is pressed.

Anyone have an idea on how to get the buttons to respond quickly? Can I temporarily disable the GestureRecogniser while the buttons are up?

Cheers Nick

like image 209
Nick Avatar asked Dec 01 '10 20:12

Nick


1 Answers

What about filtering touches on the buttons like so:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
       shouldReceiveTouch:(UITouch *)touch {
// Don't recognize taps in the buttons
return ((! [self.button1 pointInside:[touch locationInView:self.button1] withEvent:nil]) &&
        (! [self.button2 pointInside:[touch locationInView:self.button2] withEvent:nil]));
}

?

like image 123
Dagerydoo Avatar answered Sep 22 '22 07:09

Dagerydoo