1.在控制器中加入下面代码,让webView的scrollView置顶
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
[self.wkWebView.scrollView setContentInset:UIEdgeInsetsZero];
}
2.在设置ebView的约束,kStatusBarHeight为状态栏即电池条的高度
[_wkWebView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(UIEdgeInsetsMake(kStatusBarHeight, 0, 0, 0));
}];