开发者

How to disable gesture recognizer in navigationBar?

开发者 https://www.devze.com 2023-03-05 22:54 出处:网络
I have a question about disabling gesture recognizer in nationBar Now, I\'m developing an E-book application for iPad. I used UIGestureRecognizer to implement the effect of turning pages. but I coinci

I have a question about disabling gesture recognizer in nationBar Now, I'm developing an E-book application for iPad. I used UIGestureRecognizer to implement the effect of turning pages. but I coincidently found that if I swiped in the navigation 开发者_如何学运维bar at the top of screen, it also worked. So, how can I disable the gesture recognizer in navigation bar and just enable it for the rest of screen?


Assuming you have an outlet to your navigation bar, you should be able to handle this in your gesture handling method

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

That should do the trick for you

0

精彩评论

暂无评论...
验证码 换一张
取 消