I need to create a UITableView in which UITableViewCell contains two UILabel, one of them should fit height to its content NSString. The width of the UILabel is fixed, and the number of lines is set to 0. How can I get the height ?
I see code like this:
CGSize maximumSize = CGSizeMake(300, 9999);
NSString *myString = @"This is a long string which wraps";
UIFont *myFont = [UIFont fontWithName:@"Helvetica" size:14];
CGSize myStringSize = [myString sizeWithFont:myFont
constrainedToSize:maximumSize
lineBreakMode:self.myLabel.lineBreakMode];
but the result is: there is only one character in a line of UILabel.
Why cannot I use this method? Thank you very much!
I finally get it working, code in my project:
}
reference:Apple Support Communities