Take the 2-minute tour ×

I've got another problem my my UITableView: I dynamically load "Questions" from a XML File and show them inside cells of my UITableView, where the user can also answer them. The Problem is: if you scroll down, and then scroll up again, the answers that you typed before, just disappear. I've also noticed that UITableView calls the method tableView:cellForRowAtIndexPath: again, and that is exacty my problem, cause this method loads the questions from the XML File again so that all the answers that the User has typed get lost.

How can I keep all the cells in memory, and stop doing lazy loading of the cells?

I would appreciate any suggestions.


share|improve this question

2 Answers 2

up vote 2 down vote accepted

Store and preserve retrieved data in an NSMutableArray and hook this up as a data source to the table view.

share|improve this answer
I know this possibility already, but what I really want is to stop this lazy loading and not have to do this. –  jcdmb Jul 5 '10 at 15:13
Parse all of the XML into an array before you present the table view. –  Alex Reynolds Jul 5 '10 at 15:17
Your suggestion would solve my problem, but it is not an answer to my question: I want actually to stop lazy loading the view. Thx anyway! –  jcdmb Jul 5 '10 at 15:28

Assign unique reuse identifier to each cell.

// Customize the appearance of table view cells.

NSString *CellIdentifier = UNIQUE string for row;

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) 
    cell = [[self.tableSections objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];

return cell;


share|improve this answer

Your Answer


