Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pronebird/uicollectionview-nsfetchedresultscontroller
A simple category on UICollectionView to perform content changes in UITableView fashion. Comes handy with NSFetchedResultsController.
https://github.com/pronebird/uicollectionview-nsfetchedresultscontroller
Last synced: 30 days ago
JSON representation
A simple category on UICollectionView to perform content changes in UITableView fashion. Comes handy with NSFetchedResultsController.
- Host: GitHub
- URL: https://github.com/pronebird/uicollectionview-nsfetchedresultscontroller
- Owner: pronebird
- Created: 2014-04-21T11:10:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-05T20:53:02.000Z (over 10 years ago)
- Last Synced: 2023-03-15T11:45:23.041Z (over 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 215 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
UICollectionView-NSFetchedResultsController
=================================A simple category on UICollectionView to perform content changes in UITableView fashion. Comes handy with NSFetchedResultsController.
Each `-[UICollectionView beginUpdates]` must be balanced with `-[UICollectionView endUpdatesWithCompletion:]`. You can do any changes to UICollectionView in between.
Example use case with NSFetchedResultsController:
```objective-c
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
[self.collectionView beginUpdates];
}- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
[self.collectionView endUpdatesWithCompletion:^(BOOL finished) {}];
}- (void)controller:(NSFetchedResultsController *)controller
didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath
forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath
{
switch(type) {
case NSFetchedResultsChangeInsert:
[self.collectionView insertItemsAtIndexPaths:@[ newIndexPath ]];
break;
case NSFetchedResultsChangeDelete:
[self.collectionView deleteItemsAtIndexPaths:@[ indexPath ]];
break;
case NSFetchedResultsChangeMove:
[self.collectionView moveItemAtIndexPath:indexPath toIndexPath:newIndexPath];
break;
case NSFetchedResultsChangeUpdate:
[self.collectionView reloadItemsAtIndexPaths:@[ indexPath ]];
break;
}
}
```