Instance Method

targetContentOffsetForProposedContentOffset:

Returns the content offset to use after an animated layout update or change.

Declaration

- (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset;

Parameters

proposedContentOffset

The proposed point (in the coordinate space of the collection view’s content view) for the upper-left corner of the visible content. This represents the point that the collection view has calculated as the most likely value to use at the end of the animation.

Return Value

The content offset that you want to use instead. The default implementation of this method returns the value in the proposedContentOffset parameter.

Discussion

During layout updates, or when transitioning between layouts, the collection view calls this method to give you the opportunity to change the proposed content offset to use at the end of the animation. You might override this method if the animations or transition might cause items to be positioned in a way that is not optimal for your design.

The collection view calls this method after calling the prepareLayout and collectionViewContentSize methods.

See Also

Providing Layout Attributes

layoutAttributesClass

Returns the class to use when creating layout attributes objects.

- prepareLayout

Tells the layout object to update the current layout.

- layoutAttributesForElementsInRect:

Returns the layout attributes for all of the cells and views in the specified rectangle.

- layoutAttributesForItemAtIndexPath:

Returns the layout attributes for the item at the specified index path.

- layoutAttributesForInteractivelyMovingItemAtIndexPath:withTargetPosition:

Returns the layout attributes of an item when it is being moved interactively by the user.

- layoutAttributesForSupplementaryViewOfKind:atIndexPath:

Returns the layout attributes for the specified supplementary view.

- layoutAttributesForDecorationViewOfKind:atIndexPath:

Returns the layout attributes for the specified decoration view.

- targetContentOffsetForProposedContentOffset:withScrollingVelocity:

Returns the point at which to stop scrolling.