//宽度不变,动态设置label的高度
- (CGFloat)setLabelHeightWithSizeFont:(CGFloat)font textStr:(NSString *)str{
CGSize sizeBody = [str boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 2*15, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:[NSDictionary dictionaryWithObjectsAndKeys:FontSystem(font),NSFontAttributeName, nil] context:nil].size;
return sizeBody.height;
}
//高度不变,动态设置label的宽度
- (CGFloat)setLabelWidthWithSizeFont:(CGFloat)font str:(NSString *)str lblHeight:(CGFloat)height{
CGSize textLimit = [str boundingRectWithSize:CGSizeMake(MAXFLOAT, height) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:font],NSFontAttributeName, nil] context:nil].size;
return textLimit.width;
}