-(float)getLabelHeight:(NSString *)str andFont:(CGFloat )font andWidth:(float)width
{
if([[[UIDevice currentDevice] systemVersion] floatValue] < 7 )//ios 7 之前自适应
{
// UIFont *font = [UIFont systemFontOfSize:font];
CGSize maxSize=CGSizeMake(width, MAXFLOAT);
CGSize size = [str sizeWithFont:[UIFont systemFontOfSize:font] constrainedToSize:maxSize lineBreakMode:UILineBreakModeWordWrap];
return size.height;
}
else
{
NSDictionary *dic=@{ NSFontAttributeName:[UIFont systemFontOfSize:font]};
CGSize maxSize=CGSizeMake(width, MAXFLOAT);
CGRect rect=[str boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
return rect.size.height;
}
}