Instance Method

prepareForCollectionViewUpdates:

Performs needed tasks before items are inserted, deleted, or moved within the collection view.

Declaration

- (void)prepareForCollectionViewUpdates:(NSArray<NSCollectionViewUpdateItem *> *)updateItems;

Parameters

updateItems

An array of NSCollectionViewUpdateItem objects that identify the changes being made.

Discussion

When items are inserted, deleted, or moved, the collection view calls this method to report those changes to the layout object. The default implementation uses the provided information to plan the layout animations needed to respond to the changes. Subclasses can override this method and use it to prepare for any custom changes, but you should always call super at some point in your implementation.

See Also

Responding to Collection View Updates

- finalizeCollectionViewUpdates

Performs needed steps after items are inserted, deleted, or moved within a collection view.

- indexPathsToInsertForSupplementaryViewOfKind:

Returns the index paths for any supplementary views that the layout object wants to add to the collection view.

- indexPathsToInsertForDecorationViewOfKind:

Returns the index paths for any decoration views that the layout object wants to add to the collection view.

- initialLayoutAttributesForAppearingItemAtIndexPath:

Returns the starting layout information for an item being inserted into the collection view.

- initialLayoutAttributesForAppearingSupplementaryElementOfKind:atIndexPath:

Returns the starting layout information for a supplementary view being added to the collection view.

- initialLayoutAttributesForAppearingDecorationElementOfKind:atIndexPath:

Returns the starting layout information for a decoration view being added to the collection view.

- indexPathsToDeleteForSupplementaryViewOfKind:

Returns the index paths for any supplementary views that the layout object wants to remove from the collection view.

- indexPathsToDeleteForDecorationViewOfKind:

Returns index paths for any decoration views that the layout object wants to remove from the collection view.

- finalLayoutAttributesForDisappearingItemAtIndexPath:

Returns the ending layout information for an item being removed from the collection view.

- finalLayoutAttributesForDisappearingSupplementaryElementOfKind:atIndexPath:

Returns the ending layout information for a supplementary view being removed from the collection view.

- finalLayoutAttributesForDisappearingDecorationElementOfKind:atIndexPath:

Returns the ending layout information for a decoration view being removed from the collection view.