Reputation: 1371
I'm creating a UITableView and I need the cells to be of UITableViewCellStyleValue2, that's to say a right-aligned label on the left hand side, like those on the Contacts App.
It works fine but I would like this label to have more width in order to fit the text I want to display.
I haven't find anything on the iOS documentation so is it possible at all? if yes, how? I wonder if I missed something on the search.
Thanks in advance!
Upvotes: 0
Views: 863
Reputation: 21967
as @lluismontero suggests, custom cells give you the most flexibility and are not overly complicated.
if you do want to customize the default cells you can in tableView:cellForRowAtIndexPath:
add subviews to the contentView
of the default cell after it has been created. You can add any subviews you like so you can add your own right aligned UILabel
and don't use the built-in detailTextLabel
.
EDIT: remove the suggestion to use 'tableView:willDisplayCell:forRowAtIndexPath:` as the frame is set after this method
Upvotes: 1
Reputation: 3492
I think you need to implement your custom UITableViewCell. Take a look at http://zcentric.com/2008/08/05/custom-uitableviewcell/
Upvotes: 1