title: moveRowAtIndexPath in UITableView causes incorrect animation
body: <p>I have a simple UITableView Controller that shows CoreData. I'm trying to implement - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath; and having trouble with the animation. The Core Data store gets updated, but the animation is not working.</p>
  
  <p>How can I get the animation to correctly reflect the changes that are happening to the core data objects? </p>
  
  <p>For example:</p>
  
  <p>Initial order:</p>
  
  <p><img src="https://i.stack.imgur.com/YagYl.jpg" alt="alt text"></p>
  
  <p>After item 2 to the top:</p>
  
  <p><img src="https://i.stack.imgur.com/jRtaV.jpg" alt="alt text"></p>
  
  <p>or, Initial Order:</p>
  
  <p><img src="https://i.stack.imgur.com/YagYl.jpg" alt="alt text"></p>
  
  <p>After moving item 1 to position 3:</p>
  
  <p><img src="https://i.stack.imgur.com/ns5FH.jpg" alt="alt text"></p>
  
  <p>Here's the relevant code:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
  //this implementation is from this tutorial: http://www.cimgf.com/2010/06/05/re-ordering-nsfetchedresultscontroller/
  NSMutableArray *things = [[fetchedResultsController fetchedObjects] mutableCopy];
  
  // Grab the item we're moving.
  NSManagedObject *thing = [fetchedResultsController objectAtIndexPath:fromIndexPath];
  
  // Remove the object we're moving from the array.
  [things removeObject:thing];
  // Now re-insert it at the destination.
  [things insertObject:thing atIndex:[toIndexPath row]];
  
  // All of the objects are now in their correct order. Update each
  // object's displayOrder field by iterating through the array.
  
  
  int i = 0;
  for (NSManagedObject *mo in things)
  {
      [mo setValue:[NSNumber numberWithInt:i++] forKey:@"order"];
  }
  
  
  NSLog(@"things: %@", things);
  [things release], things = nil; 
  
  [managedObjectContext save:nil];            
  }
  </code></pre>
  
  <p>and the delegate:</p>
  
  <pre><code>- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath {
  NSLog(@"didChangeObject:");
  UITableView *tableView = self.tableView;
  
  switch(type) {
      case NSFetchedResultsChangeInsert:
          NSLog(@"ResultsChangeInsert:");
          [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
          break;
  
      case NSFetchedResultsChangeDelete:
          [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
          break;
  
      case NSFetchedResultsChangeMove:
          [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
          [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
          break;
  }
  }
  </code></pre>