How can I maintain display order in UITableView using Core Data?

后端 未结 4 1616
说谎
说谎 2020-12-12 18:01

I\'m having some trouble getting my Core Data entities to play nice and order when using an UITableView.

I\'ve been through a number of tutorials and other questions

4条回答
  •  天命终不由人
    2020-12-12 18:18

    I think that:

        affectedObject.displayOrderValue = toIndex;
    

    must be placed after:

       for (NSUInteger i = start; i <= end; i++) {
        FFObject *otherObject = [self.fetchedResultsController.fetchedObjects objectAtIndex:i];  
        NSLog(@"Updated %@ / %@ from %i to %i", otherObject.name, otherObject.state, otherObject.displayOrderValue, otherObject.displayOrderValue + delta);  
        otherObject.displayOrderValue += delta;
    }
    

    and before:

        [self FF_fetchResults];  
    

提交回复
热议问题