按下按钮时忽略UIGestureRecognizer

按下按钮时忽略UIGestureRecognizer

本文介绍了按下按钮时忽略UIGestureRecognizer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我设置了一个手势识别器,以便在点击屏幕时我的工具栏向下滑动。当我点击栏上的按钮时,这就算是一个点击。在这些情况下如何取消手势?

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?

谢谢

推荐答案

您可以查看SimpleGestureRecognizers示例项目。

You can look at the SimpleGestureRecognizers sample project.

- (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;
}

这篇关于按下按钮时忽略UIGestureRecognizer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:30