Instance Method

layoutAttributesForItemAtIndexPath:

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

Declaration

- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath;

Parameters

indexPath

The index path of the item.

Return Value

A layout attributes object containing the information to apply to the item’s cell.

Discussion

Subclasses must override this method and use it to return layout information for items in the collection view. You use this method to provide layout information only for items that have a corresponding cell. Do not use it for supplementary views or decoration views.

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.

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

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

- targetContentOffsetForProposedContentOffset:withScrollingVelocity:

Returns the point at which to stop scrolling.