Type Method

layoutAttributesForCellWithIndexPath:

Creates and returns a layout attributes object that represents a cell with the specified index path.

Declaration

+ (instancetype)layoutAttributesForCellWithIndexPath:(NSIndexPath *)indexPath;

Parameters

indexPath

The index path of the cell.

Return Value

A new layout attributes object whose precise type matches the type of the class used to call this method.

Discussion

Use this method to create a layout attributes object for a cell in the collection view. Cells are the main type of view presented by a collection view. The index path for a cell typically includes both a section index and an item index for locating the cell’s contents in the collection view’s data source.

See Also

Creating Layout Attributes

+ layoutAttributesForSupplementaryViewOfKind:withIndexPath:

Creates and returns a layout attributes object that represents the specified supplementary view.

+ layoutAttributesForDecorationViewOfKind:withIndexPath:

Creates and returns a layout attributes object that represents the specified decoration view.