//自适应文字的高度
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString *height_str= [webView stringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"];
int height = [height_str intValue];
webView.frame = CGRectMake(0,titleLabel.frame.origin.y+titleLabel.frame.size.height+5,SCREEN_WIDTH-20,height+30);
timeLabel.frame=CGRectMake(20, webView.frame.origin.y+webView.frame.size.height+5, SCREEN_WIDTH-10-10, 20);
background.frame = CGRectMake(10, 20, SCREEN_WIDTH-20, timeLabel.frame.origin.y+timeLabel.frame.size.height+5);
NSLog(@"height: %@", [webView stringByEvaluatingJavaScriptFromString: @"document.body.offsetHeight"]);
}
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/app/5133.html