Protocol: NSFetchedResultsControllerDelegate

Overview

An instance of NSFetchedResultsController uses methods in this protocol to notify its delegate that the controller’s fetch results have been changed due to an add, remove, move, or update operations.Notifies the receiver that a fetched object has been changed due to an add, remove, move, or update. Notifies the receiver of the addition or removal of a section. Returns the name for a given section.Notifies the receiver that the fetched results controller has completed processing of one or more changes due to an add, remove, move, or update.Notifies the receiver that the fetched results controller is about to start processing of one or more changes due to an add, remove, move, or update. Specify types of change.

Instance Method Summary (collapse)

Instance Method Details

- (Object) controller(controller, didChangeObject:anObject, atIndexPath:indexPath, forChangeType:type, newIndexPath:newIndexPath)

Notifies the receiver that a fetched object has been changed due to an add, remove, move, or update. The fetched results controller reports changes to its section before changes to the fetch result objects.Changes are reported with the following heuristics:On add and remove operations, only the added/removed object is reported.It’s assumed that all objects that come after the affected object are also moved, but these moves are not reported. A move is reported when the changed attribute on the object is one of the sort descriptors used in the fetch request.An update of the object is assumed in this case, but no separate update message is sent to the delegate.An update is reported when an object’s state changes, but the changed attributes aren’t part of the sort keys. 

Parameters:

  • controller (NSFetchedResultsController )

    The fetched results controller that sent the message.

  • anObject (Object)

    The object in controller’s fetched results that changed.

  • indexPath (NSIndexPath )

    The index path of the changed object (this value is nil for insertions).

  • type (NSFetchedResultsChangeType)

    The type of change. For valid values see “NSFetchedResultsChangeType.”

  • newIndexPath (NSIndexPath )

    The destination path for the object for insertions or moves (this value is nil for a deletion).

Returns:

- (Object) controller(controller, didChangeSection:sectionInfo, atIndex:sectionIndex, forChangeType:type)

Notifies the receiver of the addition or removal of a section. The fetched results controller reports changes to its section before changes to the fetched result objects.

Parameters:

  • controller (NSFetchedResultsController )

    The fetched results controller that sent the message.

  • sectionInfo (Object)

    The section that changed.

  • sectionIndex (Integer)

    The index of the changed section.

  • type (NSFetchedResultsChangeType)

    The type of change (insert or delete). Valid values are NSFetchedResultsChangeInsert and NSFetchedResultsChangeDelete.

Returns:

- (String) controller(controller, sectionIndexTitleForSectionName:sectionName)

Returns the name for a given section. This method does not enable change tracking. It is only needed if a section index is used.If the delegate doesn’t implement this method, the default implementation returns the capitalized first letter of the section name (see sectionIndexTitleForSectionName: in NSFetchedResultsController).

Parameters:

Returns:

  • (String)

    The string to use as the name for the specified section.

- (Object) controllerDidChangeContent(controller)

Notifies the receiver that the fetched results controller has completed processing of one or more changes due to an add, remove, move, or update. This method is invoked after all invocations of controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: and controller:didChangeSection:atIndex:forChangeType: have been sent for a given change event (such as the controller receiving a NSManagedObjectContextDidSaveNotification notification).

Parameters:

Returns:

- (Object) controllerWillChangeContent(controller)

Notifies the receiver that the fetched results controller is about to start processing of one or more changes due to an add, remove, move, or update. This method is invoked before all invocations of controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: and controller:didChangeSection:atIndex:forChangeType: have been sent for a given change event (such as the controller receiving a NSManagedObjectContextDidSaveNotification notification).

Parameters:

Returns: