当前位置:  开发笔记 > 前端 > 正文

如何将手势识别器添加到UIWebView子类?

如何解决《如何将手势识别器添加到UIWebView子类?》经验,为你挑选了1个好方法。

如果我将一个手势识别器添加到一个UIWebView被调用的子类实例webView,例如:

UILongPressGestureRecognizer *_longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(webViewGestureRecognized:)];
_longPressRecognizer.allowableMovement = 20;
_longPressRecognizer.minimumPressDuration = 1.0f;
[webView addGestureRecognizer:_longPressRecognizer];
[_longPressRecognizer release], _longPressRecognizer = nil; 

-webViewGestureRecognized:当我执行长按选择不叫.

我已经覆盖了委托方法,-gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:但仍未调用长按选择器.

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

我可以做些什么来在网络视图上启用我自己的手势识别器吗?



1> 小智..:

据我所知,UIWebView不应该像Apple文档中提到的那样进行子类化:

http://developer.apple.com/iphone/library/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html

推荐阅读
雨天是最美
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有