iOS 5 finally added a moveRowAtIndexPath:toIndexPath:
method to UITableView
. Problem is, calling it only moves the row, it doesn't update/redraws it. The only way to do so seems to be by finding the cell and calling setNeedsDisplay directly. But this is tricky since you never know whether the cell already got moved or not.
I can't call reloadRowsAtIndexPaths:
either, since I'm not allowed to have 2 animations applied to a single row inside the same beginUpdates-endUpdates
block.
There are may workarounds I can think of, like splitting the whole thing into 2 animation blocks. But I'm wondering whether I'm missing something, as the whole behavior seems odd to me.
Finally received an official answer from Apple regarding this issue:
Engineering has determined that this issue behaves as intended based on the following information:
Only insert and update cause the cell to be requested from the data source (the first because it's new and the second because you've explicitly told the table view to update the cell). Delete and move don't update the contents because that's not implicit in the action being performed. If you need to change the contents of the cell during the update, just reach into the cell and change the contents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With