kturner
kturner

Reputation: 1111

Table View cell image dissappear and reappear on selection

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!

Upvotes: 0

Views: 190

Answers (2)

kturner
kturner

Reputation: 1111

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!

Upvotes: 0

bkbeachlabs
bkbeachlabs

Reputation: 2171

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.

Upvotes: 1

Related Questions