CGSize maxSize = CGSizeMake(SCRREEN_WIDTH- 70, MAXFLOAT);
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc]init];
paragraph.lineBreakMode = NSLineBreakByWordWrapping;
UIFont *font = [UIFont systemFontOfSize:13.0];
NSDictionary *dic = @{NSFontAttributeName:font,NSParagraphStyleAttributeName:paragraph};
CGRect rect = [_commentLab.text boundingRectWithSize:maxSize options:NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
_commentLabHeight.constant = rect.size.height;
计算 label 宽高
最新推荐文章于 2021-02-17 06:02:58 发布