How to implement touch events in uiwebview?

I tried various solutions offered on this site, and others - for implementing touch events on uiwebview. But still I can’t do it. In fact, I created an article reader. Here I added uiwebview about normal uiview. Now I want to trace some user touch events on this particular webview. When I do this at a normal level, it works fine. But if I try this on a webview. he stops working. The solutions I tried before

  • implementation of touch methods such as touchbegan touchended touchmoved touch is canceled

2 implementation of uigesturerecognizer 3 implementation of window touch events, such as a send event

Now, if someone can help me or tell me where I am doing the wrong or a new decision (other than this), then I will be grateful.

+3
source share
2 answers

Place a transparent UIVIew on top of your UIWebView to capture strokes. You can then act on them or possibly pass them to a UIWebView using the touchhesBegan removal method.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    [self.myUIWebView touchesBegan:touches withEvent:event];
}

Check out this previous post for details: iOS - move all touches through the view

+2
source

UIWebView "" 2- ( , iOS6-7). , , .

for (UIView* view in self.subviews) {
    for (UIGestureRecognizer* recognizer in view.gestureRecognizers) {
        [recognizer addTarget:self action:@selector(touchEvent:)];
    }
    for (UIView* sview in view.subviews) {
        for (UIGestureRecognizer* recognizer in sview.gestureRecognizers) {
            [recognizer addTarget:self action:@selector(touchEvent:)];
        }
    }
}
0

All Articles