webview大小、位置正確沒有產(chǎn)生偏移,但webview.scrollView的子視圖UIWebBrowserView向下偏移。
在viewDidLoad中添加
self.automaticallyAdjustsScrollViewInsets = NO;
但是由于這是屬性在iOS11中過期,所以完整的寫法是
if (@available(iOS 11.0, *)) {
self.webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}