我正在加载本地 html 文件,因为 iOS7 在 UIWebView 的顶部添加了空白.(我无法发布图像,因为我没有足够的积分.)图片可以在这里看到 - 从 iPhone 模拟器快照,uiwebview被黑框包围,html内容是灰色的,但是上面加了白色
Im loading local html files, since iOS7 there is added white space on top in the UIWebView.(I cant post an image as i do not have enough points.) image can be seen here- snap shot from iPhone simulator, uiwebview surrounded by black frame, the html content is grey, but there is white added above it
我尝试使用
[webView stringByEvaluatingJavaScriptFromString:@"document. body.style.zoom = 5.0;"];
webView.scalesPageToFit = NO;
我还设置了尝试去除空白:
I also set tried to remove white spacing:
NSString *padding = @"document.body.style.margin='0';document.body.style.padding = '0'";
[webView stringByEvaluatingJavaScriptFromString:padding];
仍然没有运气.在桌面 chrome 浏览器中没有空格.html 文件是 Google Swiffy 文件 - 包含 html 和 JSON.
still no luck. In the desktop chrome browser there is no whitespace. The html files are Google Swiffy files - containing html and JSON.
更新图片
在 ViewDidLoad 中尝试 self.automaticallyAdjustsScrollViewInsets = NO;.
Try self.automaticallyAdjustsScrollViewInsets = NO; in ViewDidLoad.
ios 7 自动为滚动视图添加 64px.(状态栏和导航栏)
ios 7 add 64px automatically for scroll view. (status bar and nav bar)
这篇关于在 UIWebview 中添加了空格 - 在 iOS7 & 中删除 UIWebView 空格iOS8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!