【问题标题】:How to disable gesture recognizer in navigationBar?如何在导航栏中禁用手势识别器?
【发布时间】:2011-05-16 05:59:22
【问题描述】:

我有一个关于在nationBar 中禁用手势识别器的问题 现在,我正在为 iPad 开发一个电子书应用程序。我用UIGestureRecognizer实现翻页效果。但我偶然发现,如果我在屏幕顶部的导航栏中滑动,它也可以工作。那么,如何在导航栏中禁用手势识别器并在屏幕的其余部分启用它?

【问题讨论】:

    标签: objective-c xcode uigesturerecognizer


    【解决方案1】:

    假设你的导航栏有一个出口,你应该能够在你的手势处理方法中处理这个

    - (void)handleGesture:(UIGestureRecognizer *)gesture {
        if (CGRectContainsPoint([myNavBar frame], [gesture locationInView:self.view])) {
            // gesture occured in your navigation bar, so return;
            return;
        }
        // continue with your normal code for handling the gesture;
    }
    

    这应该对你有用

    【讨论】:

      猜你喜欢
      • 2022-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多