I have created a UITableViewController. Within it I create a custom views which are returned for the header from viewForHeaderInSection. If I go into edit mode and reorder the cells, the reordered cells float above above the custom header view during scrolling. This will continue until the tableview is reloaded with [tableview reload]. Its as if the cells are moved to the top of the view stack after being dropped from the reorder.
I have got round the problem with a [tableView reload] at the end of moveRowAtIndexPath method, but I’d like to know if this is the expected behaviour. I haven’t been able to find anything about it in the documentation or googling.
I think this is a bug in UITableView. If you examine the view hierarchy of a table during the moveRowAtIndexPath method you can see that the cell in question is near the top of the hierarchy – this is to support the look of it when you are dragging the cell around.
You can’t simply move the view to the back of the hierarchy in this method either, because it has an animation in place on it which seems to override that.
I wasn’t comfortable reloading rows from within a data update method, so my solution was to include this code:
The 0.4 second delay is to give the animation in place on the cell time to complete.
Radar’d: http://openradar.appspot.com/radar?id=2681402