在UIWebview中添加了空格 - 删除了iOS7和iOS中的UIWebView空白。 iOS8上 [英] Added whitespace in UIWebview - removing UIWebView whitespace in iOS7 & iOS8
问题描述
我正在加载本地html文件,因为iOS7在UIWebView中添加了空白区域。(由于我没有足够的分数,我无法发布图像。)
图片可以在这里看到 - 从iPhone模拟器拍摄,uiwebview被黑框包围,html内容是灰色的,但上面加了白色
我试图使用
<调整缩放pre>
[webView stringByEvaluatingJavaScriptFromString:@document.body.style.zoom = 5.0;];
webView.scalesPageToFit = NO;
我也尝试删除白色间距:
NSString * padding = @document.body .style.margin ='0'; document.body.style.padding ='0';
[webView stringByEvaluatingJavaScriptFromString:padding];
仍然没有运气。在桌面Chrome浏览器中没有空格。 html文件是Google Swiffy文件 - 包含html和JSON。
编辑:更新图片
尝试 self.automaticallyAdjustsScrollViewInsets = NO ; 在ViewDidLoad中。
ios 7为滚动视图自动添加64px。 (状态栏和导航栏)
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
I have tried to adjust the zoom using
[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];
still no luck. In the desktop chrome browser there is no whitespace. The html files are Google Swiffy files - containing html and JSON.
edit: updated Image
Try self.automaticallyAdjustsScrollViewInsets = NO; in ViewDidLoad.
ios 7 add 64px automatically for scroll view. (status bar and nav bar)
这篇关于在UIWebview中添加了空格 - 删除了iOS7和iOS中的UIWebView空白。 iOS8上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!