user2662468 user2662468 - 1 year ago 54
Swift Question

Changing the selection colour of cells in a static table view

Could anyone help me with changing the selected cell background colour in a static table? I have a static table as a form, with a white background, when tapping in the cell to edit the text field, the cell i have selected goes grey. Is there a way to change this to white?

I know how to do this in dynamically generated tables, but not static. Any help would be appreciated!

Answer Source

Even if it's static tableview you can implement the

override func tableView(_ tableView: UITableView, shouldHighlightRowAt      indexPath: IndexPath) -> Bool {
return false

This will stop the selected static tableview cell from highlighting.

Or if you want to do it in storyboard you can change the selection attribute in attribute inspector of each cell to none.