我在XIB上构建了一个UIWebview
,其设置如下:
[self.webView setScalesPageToFit:YES];
self.webView.opaque = NO;
然而,底部有一些白色空间,而如果我尝试使用Mac的Chrome和iOS模拟器的Safari,它就没有那个空白区域。我UIWebview
中缺少什么设置?
答案 0 :(得分:0)
试试此代码
- (void)initWebView {
self.webView.scalesPageToFit=NO;
[self.webView setOpaque:NO];
self.webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin ;
[(UIScrollView*)[self.webView.subviews objectAtIndex:0] setShowsHorizontalScrollIndicator:NO];
[(UIScrollView*)[self.webView.subviews objectAtIndex:0] setShowsVerticalScrollIndicator:NO];
[self.webView.scrollView flashScrollIndicators];
self.webView.frame=self.view.bounds;
self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor whiteColor];
self.webView.scrollView.scrollEnabled = YES;
}
viewDidLoad方法中的稍后会将其调用为
[self initWebView ];