Reputation: 1137
In my tableView, I have a subView with a background colour of red and anytime I select a cell in the tableview the background colour disappears. I was wondering if there was a way to fix this?
Upvotes: 0
Views: 103
Reputation: 798
You have to stop tableview cell selection style. Write below code in cellForRowAtIndexPath
method.
cell.selectionStyle = .none
For set cell background color on selection.
cell.contentView.backgroundColor = UIColor.red
// here you can set your own custom color.
Upvotes: 1