开发者

How to disable gesture recognizer in navigationBar?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜