+(CGFloat)sizeForText:(NSString *)text withFont:(UIFont *)font withWidth:(float)width
{
CGSize constraint = CGSizeMake(width, 20000.0f);
CGSize size = [text sizeWithFont:font
constrainedToSize:constraint
lineBreakMode:NSLineBreakByWordWrapping];
return size.height;
}
This property controls the maximum number of lines to use in order to fit the label’s text into its bounding rectangle. The default value for this property is 1. To remove any maximum limit, and use as many lines as needed, set the value of this property to 0.