css – 我们如何在ios 9中的uiwebview中禁用放大镜 – Swift

前端之家收集整理的这篇文章主要介绍了css – 我们如何在ios 9中的uiwebview中禁用放大镜 – Swift前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们如何在ios 9中的uiwebview中禁用放大镜?

我使用下面的代码禁用uiwebview中的选择/复制..:

* {
    -webkit-touch-callout: none;
     -webkit-user-select: none; /* Disable selection/copy in UIWebView */
}

它的工作原理,但问题是ios 9中的新放大镜,所以有没有解决方案来禁用它?
注意:我不使用Cordova

解决方法

我刚试过以下hack&它对我有用.
这将覆盖webView中的长按.

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc]initWithTarget:nil action:NULL];
longPress.minimumPressDuration = 0.2;
[webView addGestureRecognizer:longPress];

迅速

let longPress:UILongPressGestureRecognizer = UILongPressGestureRecognizer(target: nil,action: nil)
    longPress.minimumPressDuration = 0.2
    webView.addGestureRecognizer(longPress)

猜你在找的Xcode相关文章