Skip to content

giovatardu/UICollectionView-NSFetchedResultsController-1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

UICollectionView+NSFetchedResultsController

This is an example of how to use the new UICollectionView with NSFetchedResultsController. The trick is to queue the updates made through the NSFetchedResultsControllerDelegate until the controller finishes its updates. UICollectionView doesn't have the same beginUpdates and endUpdates that UITableView has to let it work easily with NSFetchedResultsController, so you have to queue them or you get internal consistency runtime exceptions.

Setup

Clone the repo and look in the UICollectionViewControllre subclass. The logic inside the .m file shows how to queue updates.

Section updates are stored in _sectionChanges while udates to objects within sections are stored in _objectChanges. When controllerDidChangeContent: is called, these updates are dequeued.

Credit

Most of the logic for this is taken from this gist.

About

How to use UICollectionView with NSFetchedResultsController

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%