Instance Method

itemAtIndexPath:

Returns the item associated with the specified index path.

Declaration

- (NSCollectionViewItem *)itemAtIndexPath:(NSIndexPath *)indexPath;

Parameters

indexPath

The index path whose item you want.

Return Value

The item for the specified index path or nil if no item is available.

Discussion

For efficiency, the collection view does not create items until they are needed, and usually it creates them only when they need to be displayed onscreen. If the collection view does not currently have an item for the specified index path, because that item would be positioned offscreen, this method returns nil.

See Also

Locating Items and Views

- visibleItems

Returns an array of the actively managed items in the collection view.

- indexPathsForVisibleItems

Returns the index paths of the currently active items.

- visibleSupplementaryViewsOfKind:

Returns an array of the actively managed supplementary views in the collection view.

- indexPathsForVisibleSupplementaryElementsOfKind:

Returns the index paths of the currently active supplementary views.

- indexPathForItem:

Returns the index path of the specified item.

- indexPathForItemAtPoint:

Returns the index path of the item at the specified point.

- supplementaryViewForElementKind:atIndexPath:

Returns the supplementary view associated with the specified index path.

- scrollToItemsAtIndexPaths:scrollPosition:

Scrolls the collection view contents until the specified items are visible.