CGSize fittingSize = [webView sizeThatFits:CGSizeZero];
CGFloat height = fittingSize.height;
CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue];
CGFloat height = self.webView.scrollView.contentSize.height;
// 判断webView是否完全加载完数据
+ (BOOL)isFinishLoadingWith:(UIWebView *)webView{
NSString *readyState = [webView stringByEvaluatingJavaScriptFromString:@"document.readyState"];
BOOL complete = [readyState isEqualToString:@"complete"];
if (complete && !webView.isLoading) {
return YES;
}else{
return NO;
}
}
//kvo方式
网友评论