Instance Method

invalidationContextForBoundsChange:

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

Declaration

- (UICollectionViewLayoutInvalidationContext *)invalidationContextForBoundsChange:(CGRect)newBounds;

Parameters

newBounds

The new bounds for the collection view.

Return Value

An invalidation context that describes the changes that need to be made. Do not return nil.

Discussion

The default implementation of this method creates an instance of the class provided by the invalidationContextClass class method 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.

You can override this method if you want to create and configure your custom invalidation context in response to a bounds change. If you override this method, you must call super first to get the invalidation context object to return. After getting this object, set any custom properties and return it.

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.

- 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.