0

In method didSelectRowAtIndexPath I use

selectedCell.accessoryType = .Checkmark

Touch Up Inside

How to change the background color of the checkmark to be different not Gray ? and how to change the color of this: Touch Down Inside This happens when I press the cell and didn't touch up the mouse button after I touch up it goes darker blue

Bogdan Bogdanov
  • 882
  • 11
  • 36
  • 79

1 Answers1

1

The gray is because you have selected the cell. The selectionStyle defaults to a solid gray color, and you have not done anything to change that. If you don't like it, change it! The easiest approach, if you just want to change what happens during selection, is to provide a selectedBackgroundView with its own backgroundColor.

enter image description here

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I tryed with selectionStyle in Attributes Inspector also in `cellForRowAtIndexPath`, in `willSelectRowAtIndexPath`, `didSelectRowAtIndexPath` and doesn't work... `selectedBackgroundView.backgroungColor = UIColor.redColor()` also doesn't work in `cellForRowAtIndexPath `, `didSelectRowAtIndexPath`, `willSelectRowAtIndexPath` – Bogdan Bogdanov Apr 07 '15 at 13:18
  • Of course it works. I've added a screen shot to prove it. The problem lies in your failure to do what I said to do (you didn't read my answer carefully), or perhaps in some other thing you're doing wrong. But you haven't shown any of your code, have you? So I don't know how you're shooting yourself in the foot, and it's not my job to guess. Based on what you've said, I've told you the answer, and it does work. – matt Apr 07 '15 at 15:11
  • 2
    In which method of tableView I have to set `selectedBackgroundView.backgroundColor` ? I told you earlier that I seted it in `willSelectRowAtIndexPath ` and `didSelectRowAtIndexPath ` and It doesn't work! – Bogdan Bogdanov Apr 08 '15 at 11:49