Search code examples
iosobjective-cselectorios13uipangesturerecognizer

iOS 13 UIPanGestureRecognizer selector not called


I'm facing an issue whereby UIPanGestureRecognizer selector is not being called. UIPanGestureRecognizer is being tied to a WKWebView and its delegate to self (view controller).

UIPanGestureRecognizer delegate method is successfully called but not the selector method.

UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panningMethod:)];

[pan setDelegate:self];

[self.mapView addGestureRecognizer:pan];


-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

Any idea? I ran the code in earlier iOS version (e.g. iOS 12.2) and it is working perfectly fine


Solution

  • WKWebView might be suppressing the gesture, found related discussion here: Can't handle touches simultaneously with WKWebView on iOS 13.4

    Hope this could help you.