shouldInvalidateLayout(forBoundsChange:)
Asks the layout object if the new bounds require a layout update.
Declaration
func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> BoolParameters
- newBounds:
The new bounds of the collection view.
Return Value
true if the collection view requires a layout update or false if the layout does not need to change.
Discussion
The default implementation of this method returns false. Subclasses can override it and return an appropriate value based on whether changes in the bounds of the collection view require changes to the layout of cells and supplementary views.
If the bounds of the collection view change and this method returns true, the collection view invalidates the layout by calling the invalidateLayout(with:) method.
See Also
Invalidating the layout
invalidateLayout()invalidateLayout(with:)invalidationContextClassinvalidationContext(forBoundsChange:)shouldInvalidateLayout(forPreferredLayoutAttributes:withOriginalAttributes:)invalidationContext(forPreferredLayoutAttributes:withOriginalAttributes:)invalidationContext(forInteractivelyMovingItems:withTargetPosition:previousIndexPaths:previousPosition:)invalidationContextForEndingInteractiveMovementOfItems(toFinalIndexPaths:previousIndexPaths:movementCancelled:)