Handling touches inside UIWebview

前端 未结 10 2127
感情败类
感情败类 2020-11-30 22:46

I have created a subclass of UIWebView , and have implemented the touchesBegan, touchesMoved and touchesEnded methods.

10条回答
  •  没有蜡笔的小新
    2020-11-30 23:46

    You could put an UIView over your UIWebView, and overide the touchesDidBegin etc, then send them to your webview. Ex:

    User touches your UIView, which provokes a

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {  
        // Execute your code then send a touchesBegan to your webview like so:
    [webView touchesBegan:touches withEvent:event];
    return;
    }
    

    your UIView has to be over the webview.

提交回复
热议问题