문제

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

도움이 되었습니까?

해결책

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

?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top