UIWebView以纵向加载20像素间隙的页面

时间:2014-11-17 11:41:32

标签: uiwebview ios8

我有一个UIWebView来加载某些页面。在iOS 8中,它加载页面与顶部20像素间隙,特别是在纵向模式下,在横向模式下它很好。
如何处理差距肖像?enter image description here

1 个答案:

答案 0 :(得分:0)

将以下代码放在viewWillAppear中:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
        CGRect viewBounds = [self.webView bounds];
        viewBounds.origin.y = 20;
        viewBounds.size.height = viewBounds.size.height - 20;
        self.webView.frame = viewBounds;
    }

检查以获取更多信息:iOS 7 Status bar with Phonegap

相关问题