1

I'm creating a simple iOS app to model a martial arts belt system. I have a table view controller with custom table view cells to show the belts. However, when I select a belt, only its background darkens. If the belt has a stripe (UIImageView), it doesn't darken when selected.

BeltCell normally

after selection

BeltCell when selected

I have tried darkening the image by overriding setSelected and setHighlighted in the BeltCell class, but perhaps I'm not understanding the problem correctly.

How can I darken the entire cell, not just its background, when the user selects it?

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
Michael Pangburn
  • 261
  • 1
  • 10
  • It's cell selection style which is making your cell dark on selection so just change your cell selection style to none and then use your selected and unselected images. You can set cell selection style from your cell's xib too. – Pankaj K. Apr 02 '17 at 03:53
  • 2
    try with `cell.selectionStyle = .none` on your cellForRowAtIndexPath – Reinier Melian Apr 02 '17 at 04:01
  • see this http://stackoverflow.com/questions/190908/how-can-i-disable-the-uitableview-selection-highlighting – Anbu.Karthik Apr 02 '17 at 04:11
  • you can set cell selectionStyle to `none` or set selected cell background to any colour you want by setting up `cell selected backgroundViews` `backgroundColor`. – Joe Apr 02 '17 at 04:22

0 Answers0