如何将单点触摸事件传递到UIWebView中的超级视图?

问题描述:

我正在使用 UIWebView 显示pdf。我想处理webview上的触摸事件。
有两个条件,我的WebView应该处理两次触摸事件和手势,我想将单击/触摸事件传递给超级视图。

I am using UIWebView to display pdf. I wanna handle touch events on webview. There are two conditions, my WebView should handle double touch events and gestures, and i wanna pass single tap/touch events to super view.

任何一个都可以请告诉我如何区分 UIWebView 中的触摸事件,以及如何将特定的触摸事件传递到其超级视图?

Can any one please tell me how to differentiate the touch events in UIWebView and how to pass specific touch events to its super view?

要获取触摸事件,我将uiwebview子类化,并覆盖子类中的hitTest方法。

to get the touch events i am subclassing the uiwebview and im overriding the hitTest method in subclass.

如果该帖子不是回答您的问题,您应该查看本文

If that post is not answering your question, you should check out this article.

我采用了类似但略有不同的方法:我将UIView子类化,其中包含UIWebView(和其他控件),并覆盖了 hitTest: withEvent:方法。

I took a similar but slightly different approach: I subclassed a UIView, which contains a UIWebView (and other controls), and override the hitTest:withEvent: method.