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
let v = UIView()
v.backgroundColor = self.darkerColor(color)
cell?.selectedBackgroundView = v;
...
func darkerColor( color: UIColor) -> UIColor {
var h = CGFloat(0)
var s = CGFloat(0)
var b = CGFloat(0)
var a = CGFloat(0)
let hueObtained = color.getHue(&h, saturation: &s, brightness: &b, alpha: &a)
if hueObtained {
return UIColor(hue: h, saturation: s, brightness: b * 0.75, alpha: a)
}
return color
}