Reputation: 10329
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 textLabel
s, 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?
Upvotes: 0
Views: 1372
Reputation: 7946
The default UILabel *textLabel
in a UITableViewCell
is 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 tag
to access the label later in order to modify it's text at a later point, and your label will still exist if/when you dequeueReusableCellWithIdentifier
assuming that you create it with said identifier.
Upvotes: 2
Reputation: 607
I think if you are using ios 5 SDK that customization is easy, just edit it in storyboard. If that's not in ios 5, I think that can't be customized.
Upvotes: 0