views:

199

answers:

1

iPhone SDK question: Does anyone have suggestions on how to purge a cached UITableViewCell

I'd like to cache these cells with reuseIdentifier. However, there are times when I need to delete or modify some of the table rows. I expect to call reloadData after the row changes.

Right now, dequeueReusableCellWithIdentifier always returns the cached(obsolete) entry from before. How do I indicate that the cache is stale and needs to be purged ?

A: 

The old data from previous usage of the cell should be cleared with the message prepareForReuse. When a cell is dequeued this message is sent to the cell before it is returned from dequeueReusableCellWithIdentifier:.

Giao
OK, thanks.I was hoping to find a way to invalidate the whole cache in one swoop.However, this solution (manually clear the data to invalidate the cache and do the invalidation, one row at a time) should also work
iPhone dev