当前位置:编程学习 > wap >>

UIWebView获得内容的高-作出自适应高的UIWebView

[cpp]  
- (void)webViewDidFinishLoad:(UIWebView *)webView  
{      
NSString *height_str= [webView stringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"];  
    int height = [height_str intValue];  
    webView.frame = CGRectMake(0,0,320,height);  
    NSLog(@"height: %@", [webView stringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"]);  
}  
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,