+ (CGFloat)labelHeight:(UILabel *)label lines:(NSInteger)lines
{
NSRange range = NSMakeRange(0, label.attributedText.length);
NSDictionary *dic = [label.attributedText attributesAtIndex:0 effectiveRange:&range];
CGSize size = CGSizeMake(label.bounds.size.width, 10000);
CGFloat height = [label.text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil].size.height;
return height + 10.0f * lines;
}
时间: 2024-08-28 10:27:42