方式一:
objectivec
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGSize attSize = [attStr boundingRectWithSize:CGSizeMake(UIScreen.mainScreen.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size;
CGFloat height = size.height;
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGSize attSize = [attStr boundingRectWithSize:CGSizeMake(UIScreen.mainScreen.bounds.size.width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size;
CGFloat height = size.height;
方式二:
objectivec
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGFloat height = [label sizeThatFits:CGSizeMake(UIScreen.mainScreen.bounds.size.width, CGFLOAT_MAX)].height;
NSMutableAttributedString *attStr = [NSMutableAttributedString new];
CGFloat height = [label sizeThatFits:CGSizeMake(UIScreen.mainScreen.bounds.size.width, CGFLOAT_MAX)].height;