iphone - How do I modify the background color of an empty UITableViewCell object based on it's position? -


i'm trying write code modify background color of cell based on it's position in table. while following code 'works', effects cells passed it. empty cells don't effected.

- (void)tableview: (uitableview*)tableview willdisplaycell: (uitableviewcell*)cell forrowatindexpath: (nsindexpath*)indexpath {     if(!indexpath.row%2)     {         cell.backgroundcolor = [uicolor colorwithred: 0.0 green: 0.0 blue: 1.0 alpha: 1.0] ;         nslog(@"blue");     }     else{         cell.backgroundcolor = [uicolor whitecolor];         nslog(@"white");     }     cell.textlabel.backgroundcolor = [uicolor clearcolor];     cell.detailtextlabel.backgroundcolor = [uicolor clearcolor]; } 

how can effect rest of cells displayed, if empty, when there few items in list?

by 'empty' cells, mean placeholder cells displayed when data source doesn't have enough data fill entire view given table view. example, if can fit 10 cells, have 5 worth of data, ever handed 5 cells work -- next 5 empty , far can tell, unaccessable.

i guess want change background of "empty" cells ... can change backgroundcolor in interfacebuilder of uitableview. affect empty cells.

you can change separator type.

also, have here : http://www.zenbrains.com/blog/en/2010/06/color-de-fondo-de-celdas-vacias/

edit :

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     // 7 depends on how many cell shown     return ([source count] <= 7) ? 7 : [source count]; } 

from : show blank uitableviewcells in custom uitableview


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -