繁体   English   中英

为什么自定义UIWindow中的UILongPressGestureRecognizer无法反映在应用程序的UIWebview中?

[英]Why the UILongPressGestureRecognizer in custom UIWindow is not reflecting in UIWebview of the application?

我已经实现了自定义UIWindow ,这将是我的主窗口。 我已经添加了一个UILongPressGestureRecognizer 除了UIWebView之外,应用程序中的所有视图均对此做出响应。 我对这个特殊的问题感到困惑。

下面是我在UIWindow实现UILongPressGestureRecognizer的方式,

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        UILongPressGestureRecognizer* longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressAction:)];
        [longPress setMinimumPressDuration:3];
        [self addGestureRecognizer:longPress];
    }
    return self;
}

有人可以为这个问题辩解吗? 如何解决呢?

谢谢 !

UIWebView内部有一个滚动视图,带有自己的手势。 基本上,您可以参考这些手势:

_webView.scrollView.panGestureRecognizer;

因此,您可以在这两个手势之间创建一个条件:

[_webView.scrollView.panGestureRecognizer requireGestureRecognizerToFail:_longGesture];

我自己还没有尝试过,但也许可以。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM