动态获取label的高度
+ (CGFloat)heighForText:(NSString *)string andScreenWidth:(CGFloat)width{
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:string];
NSRange allRange = [string rangeOfString:string];
[attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:allRange];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor darkGrayColor]range:allRange];
CGFloat titleHeight;
NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;
//获取label的最大宽度
CGRect rect = [attrStr boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)options:options context:nil];
titleHeight = ceilf(rect.size.height);
return titleHeight;
}