时间:2010-07-26 05:19:59

标签: iphone cocoa-touch iphone-sdk-3.0 uiwebview

2 个答案:

答案 0 :(得分:1)

如果该帖子没有回答您的问题,您应该查看this article

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

答案 1 :(得分:0)

子类Web视图,并在子类中使用hitTest(_ point:CGPoint,带有事件:UIEvent?)方法,

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
    if let hitTestingView = super.hitTest(point, with: event) {
        if shouldHandleTouch // Logic on which this view should handle touch or not. If you don't want to handle always then return nil {
            return hitTestingView
        } else {
            return nil
        }  
    } else {
        return nil
    }
}