動態(tài)計(jì)算web高度,代理方法里
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
CGFloat webViewHeight=[webView.scrollView contentSize].height;
CGRect newFrame = webView.frame;
newFrame.size.height = webViewHeight;
webView.frame = newFrame;
}
內(nèi)容所占長度,CGSizeMake(Label寬度, 最大高度)糟港,lineBreakMode是文字換行模式
CGSize titleSize = [note sizeWithFont:[UIFont systemFontOfSize:15] constrainedToSize:CGSizeMake(209, 1000) lineBreakMode:UILineBreakModeWordWrap];
動態(tài)計(jì)算Label高度
NSString *str ;
CGRect rect = self.rejectInfo.frame;
NSDictionary *arrts = @{NSFontAttributeName : [UIFont systemFontOfSize:15.0]};
rect.size.height = [str boundingRectWithSize:CGSizeMake(WIDTH-30, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:arrts context:nil].size.height;
self.rejectInfo.frame = rect;
//順暢顯示中文加英文,設(shè)置換行模式
self.rejectInfo.lineBreakMode = NSLineBreakByCharWrapping;
self.rejectInfo.text = str;