I need to change the UITableView cell selection style from default blue to red. Can any one help me with this?
You don't need an image or to subclass the cell. Simply do something like the following when creating the cell in your tableView:cellForRowAtIndexPath:
cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
cell.selectedBackgroundView.backgroundColor = [UIColor redColor];
You could try setting the cells' selectedBackgroundView.image
, per this tutorial. That would give you the option of creating a nice gradient-based selection image, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With