Reputation: 35933
I am trying to change the width of a UITableViewCell.
I have tried everything. Now I am trying to change it on
-
(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// trying everything...
CGRect bounds = cell.contentView.bounds;
bounds.size.width = bounds.size.width * 0.8f;
cell.contentView.bounds = bounds;
cell.backgroundView.bounds = bounds;
cell.selectedBackgroundView.bounds = bounds;
cell.bounds = bounds;
}
No change at all. Any thoughts? thanks
NOTE: I need the table width to be unchanged, because this table has a background image that must remain filling all width.
Upvotes: 0
Views: 229
Reputation: 606
Try to make your own CustomCell class
that you can customize on your purpose about frame size , content inside or other things about UIView component such a UILabel , UIImage , etc..
and then take your CustomCell class for UITableview Cell method cellForRowAtIndexPath:
hope it helps you
Upvotes: 2
Reputation: 540
May be cell.autoresizingMask = UIViewAutoresizingNone;
will help you?
Upvotes: 1