1,设置frame,有的一上来设置全屏,导致底部有些内容没法显示。正常的都是屏幕高度减去64
_webView=[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-64)];
哪怕是继承的YFCreditCardPayBaseWebViewController 自带webview _wk_WebView = [[WKWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - NAVI_HEIGHT) configuration:config];
static CGFloat const NAVI_HEIGHT = 64.0;
2,页面加载成功,但是没有标题,有时候控制器已经写了self.titile 或者vc.navigationItem.title,也是一闪而过,最后空白。问题出在
_Nullable title 这里页面是没有写值的 。如果写了 客户端就不用写了。
这种场景要加标题只能是重写这个方法,这样就有了。
- (void)webView:(WKWebView *)webView didFinishNavigation:(null_unspecified WKNavigation *)navigation{
//导航栏配置
[webView evaluateJavaScript:@"document.title" completionHandler:^(id _Nullable title, NSError * _Nullable error) {
// self.navigationItem.title = title;
if ([_isFrom isEqualToString:@"YFCreditCardPayInputCardNumViewController"]) {
self.navigationItem.title=@"信用卡还款";
}
else{
self.title = @"常见问题";
}
}];
}