objective c - How do I prevent custom UITableViewCells from flashing white on deselecting? -


i have custom uitableviewcell changes color based on row in:

tableviewcontroller.m

- (void)willdisplaycell:(gsrsongcell *)cell atindexpath:(nsindexpath *)indexpath; {     if (indexpath.row % 2 == 0) {         [cell lighten];     } else {         [cell darken];     } } 

customtableviewcell.m

- (void)lighten {     self.selectedbackgroundview.backgroundcolor = [uicolor whitecolor];     self.contentview.backgroundcolor = [uicolor whitecolor];     self.primarylabel.backgroundcolor = [uicolor whitecolor];     self.secondarylabel.backgroundcolor = [uicolor whitecolor]; } - (void)darken {     uicolor *darkcolor = [uicolor colorwithr:241 g:241 b:241 a:1];     self.selectedbackgroundview.backgroundcolor = darkcolor;     self.contentview.backgroundcolor = darkcolor;     self.primarylabel.backgroundcolor = darkcolor;     self.secondarylabel.backgroundcolor = darkcolor; } 

however, when call deselectrowatindexpath:animated:yes, animation fades white color in cells selectedbackgroundcolor should darker.

i realised deselection animation has nothing selectedbackgroundcolor; in fact, deselection animation based on tableview.backgroundcolor property!

how can override deselection animation fade background color of cells?

it animates cell background color have set too

add line in lighten method

self.backgroundcolor = [uicolor whitecolor]; 

and in darken method

self.backgroundcolor = darkcolor; 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -