iOS11之前和iOS11之后是不一样的
if (@available(iOS 8.0, *))]
{
if (@available(iOS 11.0, *)){
for (UIView* subview in wkWebView.scrollView.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"WKContentView")])
{
for (UIGestureRecognizer* longPress in subview.gestureRecognizers) {
if ([longPress isKindOfClass:UILongPressGestureRecognizer.class]) {
[subview removeGestureRecognizer:longPress];
return;
}
}
}
}
}
for (UIView* subview in wkWebView.scrollView.subviews) {
if ([subview isKindOfClass:NSClassFromString(@"WKContentViewMinusAccessoryView")])
{
for (UIGestureRecognizer* longPress in subview.gestureRecognizers) {
if ([longPress isKindOfClass:UILongPressGestureRecognizer.class]) {
[subview removeGestureRecognizer:longPress];
}
}
}
}
}