Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Usually when you see artifacts like that what is going on is the UI has animated to a new position and told you about it, then the updates you have done to your model don't correctly reflect the state which results in glitches the next time the view has to refer to the model for an update.</p> <p>I think you don't exactly understand what you are supposed to do in the method. It is called because the UI has changed and it needs to let the model to change accordingly. The code below presumes the results are already in the new order and you just need to reset the order field for some reason:</p> <pre><code> for (i = start; i &lt;= end; i++) { NSIndexPath *tempPath = [NSIndexPath indexPathForRow:i inSection:toIndexPath.section]; LinkObj *link = [fetchedResultsController objectAtIndexPath:tempPath]; //[managedObjectContext deleteObject:[fetchedResultsController objectAtIndexPath:tempPath]]; link.order = [NSNumber numberWithInteger:i]; [managedObjectContext refreshObject:link mergeChanges:YES]; //[managedObjectContext insertObject:link]; } </code></pre> <p>The catch is that you are not actually changing the order in the underlying model. Those indexPaths are from UITableViewController, it is telling you that the user dragged between those to spots and you need to update the underlying data according. But the fetchedResultsController is always in sort order, so until you have changed those properties nothing has moved.</p> <p>The thing is, they have not been moved, you are being called to tell you that you need to move them around (by adjusting the sortable property). You really need to something more like:</p> <pre><code>NSNumber *targetOrder = [fetchedResultsController objectAtIndexPath:toIndexPath]; LinkObj *link = [fetchedResultsController objectAtIndexPath:FromPath]; link.order = targetOrder; </code></pre> <p>Which will cause the objects to reorder, then go through and clean up any of the order numbers of other objects that should have shifted up, being aware the indexes may have moved.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload