Instance Method

invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:previousIndexPaths:movementCancelled:

Returns a context object that identifies the items that were moved

Declaration

- (UICollectionViewLayoutInvalidationContext *)invalidationContextForEndingInteractiveMovementOfItemsToFinalIndexPaths:(NSArray<NSIndexPath *> *)indexPaths previousIndexPaths:(NSArray<NSIndexPath *> *)previousIndexPaths movementCancelled:(BOOL)movementCancelled;

Parameters

indexPaths

The final locations of the items. For cancelled interactions, these index paths correspond to the original index paths of the items.

previousIndexPaths

The previous locations of the items. This parameter contains the last set of index paths reported by the collection view during the movement sequence.

movementCancelled

A Boolean value indicating whether the interactive movement ended successfully or was cancelled.

Return Value

An invalidation context that includes information about what changes need to be made to the layout.

Discussion

The layout object uses this method to retrieve invalidation contexts when an interactive move of one or more items ends, either because the move was successful or because it was cancelled by the user. The default implementation creates an instance of the class provided by the invalidationContextClass class method, fills it with the provided information, and returns it. If you want to use a custom invalidation context object with your layout, always override that method and return your custom class.

Subclasses can override this method and use it to perform additional configuration of the invalidation context before returning it. In your custom implementation, call super so that the parent class can perform the basic configuration of the object.

See Also

Invalidating the Layout

- invalidateLayout

Invalidates the current layout and triggers a layout update.

- invalidateLayoutWithContext:

Invalidates the current layout using the information in the provided context object.

invalidationContextClass

Returns the class to use when creating an invalidation context for the layout.

- shouldInvalidateLayoutForBoundsChange:

Asks the layout object if the new bounds require a layout update.

- invalidationContextForBoundsChange:

Returns a context object that defines the portions of the layout that should change when a bounds change occurs.

- shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:

Asks the layout object if changes to a self-sizing cell require a layout update.

- invalidationContextForPreferredLayoutAttributes:withOriginalAttributes:

Returns a context object that identifies the portions of the layout that should change in response to dynamic cell changes.

- invalidationContextForInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:

Returns a context object that identifies the items that are being interactively moved in the layout.