UINavigationController InteractivePopGestureRecognizer 在 iOS7 中工作异常 [英] UINavigationController interactivePopGestureRecognizer working abnormal in iOS7

查看:13
本文介绍了UINavigationController InteractivePopGestureRecognizer 在 iOS7 中工作异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS7中,我们有一个新的从左向右滑动"手势,这是一个非常有用的功能,但现在我遇到了问题.

In iOS7, we have a new "swipe left to right" gesture, this is a very useful feature, but now I have a problem with it.

我使用此代码自定义 UINavigationBar 中的后退按钮.

I use this code to custom the back button in UINavigationBar.

self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:view];

但这会禁用从左向右滑动"手势,所以我使用以下代码来保持手势启用.

but this will disables the "swipe left to right" gesture, so I use the follow code to keep the gesture enabled.

self.navigationController.interactivePopGestureRecognizer.delegate = self

然后,我发现手势工作异常,如果当前的ViewController有一个tableView,当tableView滚动时,手势不会被触发.现在手势不能轻易触发,有什么办法可以解决吗?

And then, I found that the gesture is working abnormal, if current ViewController has a tableView, when the tableView is scrolling, the gesture won't be triggered. Now the gesture can't be triggered easily, is there some way to fix it?

推荐答案

这段代码很适合我.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
    return [gestureRecognizer isKindOfClass:UIScreenEdgePanGestureRecognizer.class];
}

这篇关于UINavigationController InteractivePopGestureRecognizer 在 iOS7 中工作异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆