CodeFlakes
CodeFlakes

Reputation: 3711

NSFetchedResultsController while updating while scrolling

If the NSFetchedResultsControllerDelegate is processing an update (item deletion for example) and the user scrolls the UITableView at the same time.

What happens if the UITableView needs to access a fetch request item that is being deleted ? Should I test that in cellForRowAtIndexPath and how ?

Or is it impossible to occur ?

Upvotes: 0

Views: 618

Answers (1)

gerry3
gerry3

Reputation: 21460

This is not an issue. Core Data and table views handle this.

Just make sure that you update your table view after managed object(s) have been inserted and/or deleted.

The easiest way is to have the table view reloadData in the NSFetchedResultsControllerDelegate method controllerDidChangeContent:.

To do fancier stuff like animate rows in to or out of the table, check out the boiler plate code in the Typical Use section of the NSFetchedResultsControllerDelegate Protocol Reference.

Upvotes: 2

Related Questions