tags:

views:

260

answers:

0

I have a custom cell that displays fine when loading the initial view. However, when the cell is deleted and inserted using -deleteRowsAtIndexPaths:withRowAnimation -insertRowsAtIndexPaths:withRowAnimation (This is just one phase of the desired code, eventually it will be replaced with a different cell during editing), the cell content simply disappears! If I use -reloadData, the cell will display for a brief instant before disappearing again.

I thought this was weird, so I set up the table to call -reloadData when a cell was selected. Upon selecting a cell the cell did not disappear. However, if I replaced -reloadData with -reloadSections:withRowAnimation, the cell DID disappear. This made it sound like a problem de-queuing problem, but I don't understand what the issue might be.

To test the theory, though, I scrolled the cell off screen and let it scroll back on screen. Sure enough, the cell re-appeared!

in -tableView:cellForRowAtIndexPath, all I do for the problematic cell is set the cell equal to a pre-defined cell - i.e. cell = predefinedCell; I noticed that if I set up cell the way I set up predefinedCell, everything works normally.

Can anyone explain why the cell content disappears, and what I should do to fix the problem? I'd rather re-use predefinedCell if at all possible.