How to reload programmatically moved row?
ios, uitableview
Solution
I do not think it is possible to do a move and a reload at the same time. I've tried several approaches and the best solution I've come up with is to do the reload just before the batch updates. I don't animate `reloadRows` because it seems to conflict with the batch update animations.
[tableView reloadRowsAtIndexPaths:indexPathsToReload withRowAnimation:UITableViewRowAnimationNone];
[tableView beginUpdates];
//inserts, deletes and moves here
[tableView endUpdates];
Also, I typically put my cell configuration logic in a separate method like:
- (void)tableView:(UITableView *)tableView configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath;
So that I can just call it directly and bypass `reloadRowsAtIndexPaths` altogether. You won't get the built in animation this way either, but you can do your own animations.
Problem
Frustrating fact: After calling `tableView:moveRowAtIndexPath:toIndexPath:`, `tableView:cellForRowAtIndexPath:` doesn't get called for that row. Call `reloadRowsAtIndexPaths:withRowAnimation:` after or before `tableView:moveRowAtIndexPath:toIndexPath:` within `UITableView` updates block also doesn't work: it raises Inconsistency error. I see 2 workarounds: delete+insert instead of move or do reload within another updates block. My question is: is there some other way to reload and move UITableView's row within same updates block?