Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

How to use UICollectionView with NSFetchedResultsController

branch: master

Merge pull request #17 from GiovaMaster/master

Auto Layout's constraints infringements fix.
latest commit 5ddd6faef2
Ash Furrow authored June 06, 2013
Octocat-spinner-32 AFMasterViewController.h Initial commit. September 16, 2012
Octocat-spinner-32 AFMasterViewController.m Prevent nasty Auto Layout bugs. June 06, 2013
Octocat-spinner-32 README.md Updated README. September 16, 2012
README.md

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.

Something went wrong with that request. Please try again.