Does anyone know how to change the background color of a cell using UITableViewCell, for each selected cell? I created this UITableViewCell inside the code for TableView.
in Swift 3, converted from illuminates answer.
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
if(selected) {
self.selectionStyle = .none
self.backgroundColor = UIColor.green
} else {
self.backgroundColor = UIColor.blue
}
}
(however the view only changes once the selection is confirmed by releasing your finger)