我遇到了一个问题,我升级手机到iOS 10 beta 3,当我在我的应用程序中缩放WKWebView时,缩放功能不仅缩放网页的内容,而且还页面本身。WKWebView在iOS10中捏缩放
看到我附上的图片。 WKWebView that fails to zoom correctly.我将WKWebView的背景颜色设置为蓝色,当我缩小视图时,页面(容器?)本身也缩小,导致不利的结果。 这不会发生在iOS9中。当我做同样的事情时,蓝色背景不显示。 网页写在AngularJS
和图表lib是d3js
。
相关代码如下。
-(void) reloadWebPage{
[activityIndicator startAnimating];
NSString *indexToPath = [self getIndexHtmlPath];
NSURL *fileUrl = [NSURL fileURLWithPath:indexToPath];
NSURL *absoluteUrl = fileUrl.absoluteURL;
if(currentGroup == nil){
currentGroup = @"0";
}
NSString *absoluteString = [[absoluteUrl absoluteString] stringByAppendingFormat:@"%@%@", @"?currentGroup=", currentGroup];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:absoluteString] ];
[webView loadRequest:request];
}
- (void)createWebView{
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
[config.userContentController addScriptMessageHandler:self name:@"interOp"];
webView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:config];
[webView setBackgroundColor:[UIColor blueColor]];
[webView setNavigationDelegate:self];
[webView setUIDelegate:self];
}
我不知道问题在哪里?它是在Objective C,iOS10还是在Javascript中?
请建议,我该如何解决这个问题?
谢谢
[禁用视口缩放iOS 10 Safari浏览器?](http://stackoverflow.com/questions/37808180/disable-viewport-zooming-ios-10-safari) –
您提到的链接打算禁用缩放,我不想禁用它。另外,我也没有使用'user-scalable = no'。 –
好的,我明白了。可能你可以给一个问题页面的链接? –