美文网首页
UIWebView算高度

UIWebView算高度

作者: lifeLL | 来源:发表于2018-07-29 15:52 被阅读0次
    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方式

    相关文章

      网友评论

          本文标题:UIWebView算高度

          本文链接:https://www.haomeiwen.com/subject/puazmftx.html