在该Web视图中使用WKWebView加载URL无法禁用缩放和编辑。这是我的代码。
[myWebView = WKWebView(frame: CGRect( x: 0, y: 20, width: self.view.frame.width, height: self.view.frame.height - 20 ), configuration: WKWebViewConfiguration() )
myWebView.translatesAutoresizingMaskIntoConstraints = false
myWebView.navigationDelegate = self
myWebView.uiDelegate = self
self.myWebView.isMultipleTouchEnabled = false
view = myWebView
myWebView.scrollView.showsHorizontalScrollIndicator = false;
myWebView.scrollView.showsVerticalScrollIndicator = false;
myWebView.uiDelegate = self
myWebView.navigationDelegate = self
myWebView.scrollView.delegate = self
myWebView.scrollView.bounces = false
myWebView.scrollView.bouncesZoom = true
myWebView.isMultipleTouchEnabled = false
func viewForZooming(in: UIScrollView) -> UIView? {
return nil;
}
如何删除编辑和缩放打开。帮助我,谢谢你。
答案 0 :(得分:3)
override func viewDidLoad() {
super.viewDidLoad()
self.webView.scrollView.delegate = self
}
func scrollViewWillBeginZooming(_ scrollView: UIScrollView, with view: UIView?) {
scrollView.pinchGestureRecognizer?.isEnabled = false
}
答案 1 :(得分:1)
要在代码行下方禁用缩放
<div id = "new">
希望能帮到你