0

I need to change the colour of my cell upon selection to a desired UI Color. Below is my code, and it is working fine. However, why the checkbox area is still in grey colour? How do I change that?

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    let selectedCell:UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)!
    selectedCell.contentView.backgroundColor = UIColor(red: 43.0/255.0, green: 240.0/255.0, blue: 12.0/255.0, alpha: 1.0)
}

I don't have enough reputations to post images. Sorry in advance!
Image

jo3birdtalk
  • 616
  • 5
  • 20

2 Answers2

1

Maybe this is helpfull from my code snippet

var colorVw = UIView()
colorVw.backgroundColor = UIColor.redColor()
cell.selectedBackgroundView = colorVw
Zumry Mohamed
  • 9,318
  • 5
  • 46
  • 51
  • for more info please find [this](http://stackoverflow.com/questions/1998775/uitableview-cell-selected-color) . i also got the answer from this site. – Zumry Mohamed Dec 16 '15 at 03:17
  • thanks! it works. Deleted my `selectedCell.contentView.backgroundColor` replaced with your `colorVw.backgroundColor` – jo3birdtalk Dec 16 '15 at 03:24
  • I was doing so, but they needed me to wait for 1min. And you replied first. Thanks! – jo3birdtalk Dec 16 '15 at 03:26
0
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath)
    cell.accessoryView = nil
}
Tim
  • 2,089
  • 1
  • 12
  • 21