Some help would be greatly appreciated here!
I have a custom UITableView cell, consisting of an image (green,orange or red) and two labels in different font sizes. The UITableView is driven by an NSMutableArray of objects.
The UITableView is split into three sections, with the first section containing all the cells with the red image, second section with the orange, third section with the green.
I have implemented the ability to rearrange the cells within UITableView, allowing the user to drag, say, an item with a red image from the red section into the orange section. This dragging works great, and the underlying data is updated correctly. I know this is the case because if I select the cell, I go to its detail view and the data is updated.
However, the UITableView does not update until I go to detail (or exit the app) and return! It also does update if I scroll the offending cell out of view and back into view again, so the array is clearly containing the correct data. I just can't trigger a view refresh!
I have tried the following after my code for changing the underlying data in moveRowAtIndexPath:
[self.tableView reloadData];
However this causes an exception. The Apple Language Reference in fact says that reloadData cannot be called when inserting, deleting or animating, which is of course what I'm doing. In addition, trying just to refresh the cell with
[self setNeedsDisplay];
doesn't work (although it doesn't crash either).
Any ideas on how I can refresh the UITableView? I can't find a afterMoveHasBeenCompleted: method or anything, so if I can't call reloadData during my moveRowAtIndexPath: method then where do I call it?!