之前拿到一段代码发现只是初始化了webview并没有进行全屏处理。
之后找到问题解决如下。
CGRect webFrame = [[UIScreen mainScreen] applicationFrame]; webFrame.origin.y -= 20.0; // statusbar 20 px cut from y of frame
webView = [[UIWebView alloc] initWithFrame:webFrame];
webView.scalesPageToFit = YES;
webView.autoresizesSubviews = YES;
webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[webView setBackgroundColor:[UIColor clearColor]];
——————————————————-
其实在UIWebView里是可以取得scrollView的,当webView加载完的时候可以取scrollView的contentSize,然后重新给webView设置frame即可