我想禁止WKWebView双击导致的缩放,如何实现呢?我试过设置他的UIScrollView的delegate,但是并没有走代理方法。
解决方案 »
- malloc: *** error for object 0x6c3c5a4: incorrect checksum for freed object - ob
- Objective-C的三种编译环境
- 关于openal播放音频流的问题
- 绝对的菜鸟问几个关于IPHONE开发的问题
- cygwin生成的.a文件在iphone里调用?
- 新手求教!~ tableViewCell!!!
- 我写了个tableview 为什么不显示一级目录
- 人物图片处理,请大家给下意见
- Swift中NSURL转码问题
- UINavigationController 和UIViewController, UITabBarController的关系????
- AddressSanitizer's allocator is terminating the process instead of returning 0
- iphone 怎么写一个软件 知道连接的wifi密码
for subview in _webView.scrollView.subviews { // iterate over recognizers of subview
for recognizer in subview.gestureRecognizers ?? [] { // check the recognizer is a UITapGestureRecognizer
if recognizer.isKind(of: UITapGestureRecognizer.self) { // cast the UIGestureRecognizer as UITapGestureRecognizer
let tapRecognizer = recognizer as! UITapGestureRecognizer // check if it is a 1-finger double-tap
if tapRecognizer.numberOfTapsRequired == 2 && tapRecognizer.numberOfTouchesRequired == 1 { // remove the recognizer
subview.removeGestureRecognizer(recognizer)
}
}
}
}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">该meta标签的作用是让当前viewport的宽度等于设备的宽度,同时不允许用户手动缩放。其中 maximum-scale为允许用户的最大缩放值,user-scalable为是否允许用户进行缩放,yes(默认)代表允许,no(0)代表不允许,两者结合使用可以阻止页面被放大(经测试,少一项都达不到效果)
-