I would like to use UITableViewCellStyleValue2 but I would like to prevent creating a custom cell. However, I would like to increase the size of the textLabel size.
When I input the text for the textLabels, it sometimes is too short. The sizeToFit doesn’t either work here.
The result after I input my text:

I have also tried to log the current size but don’t get any useful details:
I did:
NSLog(@"Label frame: %f %f %f %f", cell.textLabel.frame.origin.x, cell.textLabel.frame.origin.y, cell.textLabel.frame.size.width, cell.textLabel.frame.size.height);
And got:
2011-10-24 10:33:51.084 checkout[68350:fb03] Label frame: 0.000000
0.000000 0.000000 0.000000
I also tried overwriting the size, but that didn’t work:
[cell.textLabel setFrame:CGRectMake(10.0f, 14.0f, 205.0f, 15.0f)];
How can I increase the size?
The default
UILabel *textLabelin aUITableViewCellis heavily managed.The simplest way to get around this issue is to add a label of your own to the cell (which you needn’t have a subclass to do). You can use a
tagto access the label later in order to modify it’s text at a later point, and your label will still exist if/when youdequeueReusableCellWithIdentifierassuming that you create it with said identifier.