I tested the proposed solution here to update the UICollectionView from NSFetcherResultsController . But I have some problems.
My UICollectionView shows the hierarchy (sorted by name) of folders and documents. By clicking on the document, open it and clicking on the folder, click on the new controller with UICollectionView (expand).
User can copy / cut / paste documents and folders.
Example problem:
Root | ---"B" |---"A"
If I copy form βAβ to βRootβ, βAβ is pasted into βRootβ and βBβ is updated (elmentsCount--). The problem is that βBβ gets the animation to insert, and βAβ gets the animation to update.
I placed two message blocks in the block that I use to perform a batch update:
case NSFetchedResultsChangeInsert: NSLog(@"INSERTING at pos : %d", ((NSIndexPath *)obj).item); [self.libraryCollectionBrowser insertItemsAtIndexPaths:@[obj]]; break; case NSFetchedResultsChangeUpdate: NSLog(@"UPDATING at pos : %d", ((NSIndexPath *)obj).item); [self.libraryCollectionBrowser reloadItemsAtIndexPaths:@[obj]]; break;
Journal:
INSERTING at pos : 0 UPDATING at pos : 0
What is the right way to do this?
source share