应该可以这样,没有测试-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
[HUD hide:YES];
[CommenData showNetError:self.navigationController.view];
if (error.code!=-999) {
[self loadBlankPage];
}
}
//加载本地的一个空html页面,解决webview没有加载完网页,底部留下tabbar黑色区域的问题
- (void)loadBlankPage {
NSURLRequest *errorRequest;
if (!errorRequest) {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"load_error" ofType:@"html"];
NSURL *errorUrl = [NSURL fileURLWithPath:filePath];
errorRequest = [NSURLRequest requestWithURL:errorUrl];
}
[webViews loadRequest:errorRequest];
}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
[_webView loadRequest:request];