Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignoring UIGestureRecognizer when hitting button

Tags:

ios

iphone

ipad

I have a gesture recognizer set up so that my toolbar slides down when the screen is tapped. When I hit a button on the bar, that counts as a tap. How do I cancel the gesture in those cases?

Thanks

like image 227
codeetcetera Avatar asked May 09 '11 20:05

codeetcetera


1 Answers

You can look at the SimpleGestureRecognizers sample project.

http://developer.apple.com/library/ios/#samplecode/SimpleGestureRecognizers/Introduction/Intro.html

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {

    // Disallow recognition of tap gestures in the button.
    if ((touch.view == button) && (gestureRecognizer == tapRecognizer)) {
        return NO;
    }
    return YES;
}
like image 180
jaminguy Avatar answered Sep 20 '22 13:09

jaminguy