iphone - 点击按钮时忽略 UIGestureRecognizer

标签 iphone ios ipad

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

谢谢

最佳答案

您可以查看 SimpleGestureRecognizers 示例项目。

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

关于iphone - 点击按钮时忽略 UIGestureRecognizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5942133/

相关文章:

ios - 向 UITableView 插入行时的行为

ios - 要通过蓝牙与设备通信,我必须使用哪个配置文件

iphone - 上传中断时最好的交互方式是什么?

iphone - UISplitView 应用程序中的 UIToolbar

iphone - 是否有可能(如何)让应用程序在 iPhone 的聚光灯搜索中返回自定义搜索结果?

iphone - 在 ARC 中使用 NSNotificationCenter 代码块方法时,未调用 View Controller dealloc

iphone - 将 UIImage 添加到 UITableViewCell "State Touched"

ios - 无法同时满足约束。前导和尾随约束冲突

html - flexbox ios空间分配问题

ios - 将存储在字符串中的句子的单词初始化到 UILabels 中