0

I have a custom UITableViewCell class. I am toggling between accessoryTypes of UITableViewCellAccessoryCheckmark and UITableViewCellAccessoryNone when didSelectRowAtIndexPath is called. Here's an example of what the cells look like before and after selection:

before... before selection

after.... after selection

My problem is this: the circle-colored views on the left hand side flicker when I select the cell. How do I keep the circles from flickering when the table cell is selected? I'm not manually doing any sort of reloading of the cell. Does it have something to do with selection state? Any help would be greatly appreciated; thanks!

kturner
  • 1,091
  • 2
  • 10
  • 15

2 Answers2

1

I assume that in your cellForRowAtIndexPath method you are doing something like

[cell setImage:[UIImage imageNamed:@"someImage"] forState:UIControlStateNormal];

Try setting an image for UIControlStateHighlighted and see if that helps. Even if its the same image.

bkbeachlabs
  • 2,121
  • 1
  • 22
  • 33
  • I'm actually manually adding a UIView to the cell. I am for now just setting the view's backgroundColor, and using QuartzCore to round the view into a circle. So, I don't really have a concept of "state". I wonder if I just set the image in my override of setSelected? – kturner Jul 11 '12 at 19:21
0

Yep, that was the solution. Thanks @aking63 for spiking an idea in me. By just overriding the setSelected method in my custom UITableViewCell class, and populating the indicator view the same way I was on setting up the cell, all things work as needed. No more flicker!

kturner
  • 1,091
  • 2
  • 10
  • 15