第一种:
CGSize maxSize = CGSizeMake(TheViewWithWidth - 80 - 34, MAXFLOAT);
CGFloat textH = [self.rigthLabel.text boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height;
CGRect dateFrame =CGRectMake(2, 140, CGRectGetWidth(self.frame)-5, labelSize.height);
self.rigthLabel.height = maxSize.height;
第二种:
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:14.f], NSParagraphStyleAttributeName:paragraphStyle.copy};
CGSize maxSize = [self.rigthLabel.text boundingRectWithSize:CGSizeMake(TheViewWithWidth - 80 - 34, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes context:nil].size;
self.rigthLabel.height = maxSize.height;