开发者

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开发者_JAVA技巧 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


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

?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜