I'm resizing a table's cell
and a UILabel
. The label seems to be resized, but remains on one line. How to deal with this?!
The label is set from the storyboard as:
Line Breaks: Word Wrap;
Autoshrink: Fixed Font Size;
Lines: 0
CGRect textRect = [cell.sampleLabel.text boundingRectWithSize:boundingSize options:NSStringDrawingUsesLineFragmentOrigin attributes: @{NSFontAttributeName:cell.sampleLabel.font} context:nil];
NSLog(@"textRect height: %f", textRect.size.height);
cell.sampleLabel.frame = textRect;
NSLog(@"label height: %f", cell.sampleLabel.frame.size.height);
The NSLog
:
2013-12-20 11:04:41.623 DevCloud[16613:70b] textRect height: 223.091019
2013-12-20 11:04:41.624 DevCloud[16613:70b] label height: 224.000000
2013-12-20 11:04:41.626 DevCloud[16613:70b] textRect height: 223.091019
2013-12-20 11:04:41.627 DevCloud[16613:70b] label height: 224.000000