Force UITableView to call cellForRowAtIndexPath: for all cells

eric.mitchell picture eric.mitchell · Jan 21, 2012 · Viewed 18.2k times · Source

I am having some trouble with UITableView's reloadData method. I have found that it only calls cellForRowAtIndexPath if there are new cells being added or taken away.

Example: I have five cells, each containing five strings. If I add a new cell and call reloadData, the table is updated and I see it. Yet if I go into one of the five cells, add a new string, then return and call reloadData, none of the table view's delegate methods is called.

My question: Is it possible to force the table view to completely reload the data in all of its visible cells?

Answer

eric.mitchell picture eric.mitchell · Jan 25, 2012

I found the problem- I had my cell customization code in the if(cell == nil) block, so because the cells were being recycled, they weren't being changed. Taking my customization code out of that block fixed the problem.