I have a gesture recognizer configured so that my toolbar slides down when the screen is listening. When I press a button on the panel, it is considered a tap. How can I cancel the gesture in these cases?
thanks
You can see an example of the SimpleGestureRecognizers 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; }
In Swift:
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { if touch.view is UIButton { return false } return true }