[[+content_image]]
A
A
Alexander Vasyuchenko2015-06-02 13:59:24
Objective-C
Alexander Vasyuchenko, 2015-06-02 13:59:24

Why is UILongPressGestureRecognizer skipping clicks to UIWebView?

Added UILongPressGestureRecognizer to UIWebView:

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTouch:)];
longPress.delegate = self;
longPress.minimumPressDuration = 0.5;
longPress.cancelsTouchesInView = YES;

[_webView addGestureRecognizer:longPress];

cancelsTouchesInView is set to YES, but after a long press, clicks on UIWebView are still triggered, and if the long touch, for example, was on a hyperlink, then after the long touch is triggered, the hyperlink is clicked and another page is loaded in the browser.
How to prevent clicks from passing in UIWebView after UILongPressGestureRecognizer fires?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question