商品详情页下面嵌套的是webview
现在webview的H5增加了mapview控件之后
高度计算出错了
-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
NSString *injectionJSString = @"var script = document.createElement('meta');" "script.name = 'viewport';" "script.content=\"width=device-width, user-scalable=no\";" "document.getElementsByTagName('head')[0].appendChild(script);";
[webView evaluateJavaScript:injectionJSString completionHandler:nil];
}
去掉这些js注入计算高度的方法
解决办法:
用原生的方法控制webview的缩放
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view{
scrollView.pinchGestureRecognizer.enabled= NO;
}
最后禁用了pin手势
网友评论