UILabel size depending on the amount of text


-(float)getHeightByWidth:(NSString*)myString:(UIFont*)mySize:(int)myWidth

 {
  CGSize boundingSize = CGSizeMake(myWidth, CGFLOAT_MAX);
  CGSize requiredSize = [myString sizeWithFont:mySize constrainedToSize:boundingSize lineBreakMode:UILineBreakModeWordWrap];  
  return requiredSize.height;
 }

Comments