6

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

Nick
  • 205
  • 3
  • 14
  • I am also having same issue.... but i think its kind of universal problem... which can be minimized if we could reduce the wait time for second tap. But no idea on how to do that.. – Amit Dec 18 '10 at 07:46

1 Answers1

7

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]));
}

?

Dagerydoo
  • 86
  • 1
  • 3
  • 4
    You can actually do this instead, which is cleaner since you don't have to hardcode every button into the gr delegate: `return ![touch.view isKindOfClass:[UIButton class]];` – jankins Jan 20 '13 at 16:06