Implementing the methods of the NSFetchedResultsControllerDelegate protocol
The classes that are declared as delegate of the NSFetchedResultsControllerDelegate
protocol have to implement its methods, as these methods take the necessary actions (like updating the table view) when some changes are applied to the managed object. Let us get an idea of all the four methods declared in the said protocol:
controllerWillChangeContent
controllerDidChangeContent
controller:didChangeObject
controller:didChangeSection
These four methods are defined in the protocol: NSFetchedResultsControllerDelegate
. The fetched results controller monitors its managed object context and calls its delegates as changes are made to its context. These methods help in updating the table view or take other actions on the basis of modifications applied to the context.
The controllerWillChangeContent method
When the object managed by fetchedResultsController is modified, that is, if it is deleted, updated, or a new object is added...