I need to change the selected cell background colour for all the cells in my app. As I know there is a way to use UIAppearance
protocol for this purposes. Is it possible to realize this by the category for UITableViewCell
?
You can't do this direct to UITableViewCell, but you can do it for its contentView
:
[[UIView appearanceWhenContainedIn:[UITableViewCell class], nil] setBackgroundColor:[UIColor redColor]];
Note that it will change all the subViews bg color.
Another option is writing a category or subclass the UITableViewCell
with UI_APPEARANCE_SELECTOR
mark, check this question:
iOS: Using UIAppearance to define custom UITableViewCell color