label单行显示的size
NSDictionary *attribute = @{NSFontAttributeName : [UIFont systemFontOfSize:17]};
CGSize labelSize = [self.name sizeWithAttributes:attribute];
label多行显示的size
CGFloat textW = [UIScreen mainScreen].bounds.size.width - 10 * 2;
NSDictionary *attribute1 = @{NSFontAttributeName: [UIFont systemFontOfSize:14]};
CGSize textsize = [self.text boundingRectWithSize:CGSizeMake(textW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attribute1 context:nil].size;
label最多显示两行时的size
NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
style.maximumLineHeight = 20;
style.minimumLineHeight = 20;
CGSize textsize = [self.summary boundingRectWithSize:CGSizeMake(textW, 20 * 2) options: NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:kFont(16),NSParagraphStyleAttributeName:style} context:nil].size;