PDA

View Full Version : TableView stle1 not displaying properly




satyam90
Dec 5, 2009, 12:04 AM
I have a table view. only one cell will have style1 cell and remaining all cells are default cells.
For style1 cell, I am displaying detailed text along with accessory.
Its compiling and staring the app well.
But when I scroll table veiw up/down, the detailed text is being shown in a different cell. i'm attaching the code as attachment.
can some help me in fixing this.

--Satyam.



dejo
Dec 6, 2009, 12:25 PM
The problem is when cell != nil, it's reusing a previously created cell, one that already has its style set. So, when row 0 goes offscreen, row 11 (labelled 12) grabs that cell out of the queue to use for itself, but since it didn't need to create it, it won't set the style.

EDIT: You may want to consider using a couple of different CellIdentifiers as part of your reuse strategy.