webview frame正确 内容(UIWebBrowserView)下移

webview大小、位置正确没有产生偏移,但webview.scrollView的子视图UIWebBrowserView向下偏移。

在viewDidLoad中添加

self.automaticallyAdjustsScrollViewInsets = NO;

但是由于这是属性在iOS11中过期,所以完整的写法是

if (@available(iOS 11.0, *)) {
        self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }

你可能感兴趣的:(webview frame正确 内容(UIWebBrowserView)下移)