Instance Method

makeSupplementaryViewOfKind:withIdentifier:forIndexPath:

Creates or returns a reusable supplementary view of the specified type.

Declaration

- (__kindof NSView *)makeSupplementaryViewOfKind:(NSCollectionViewSupplementaryElementKind)elementKind withIdentifier:(NSUserInterfaceItemIdentifier)identifier forIndexPath:(NSIndexPath *)indexPath;

Parameters

elementKind

The kind of supplementary view to create. This value is defined by the layout object. This parameter must not be an empty string or nil.

identifier

The reuse identifier for the specified item. This is the identifier you specified when registering the supplementary view. This parameter must not be nil.

indexPath

The index path specifying the location of the supplementary view. The data source object receives this information in its collectionView:viewForSupplementaryElementOfKind:atIndexPath: method and you should just pass it along.

Return Value

A view that adopts the NSCollectionViewElement protocol.

Discussion

This method looks for a recycled supplementary view of the specified type and returns it if one exists. If one does not exist, it creates it using one of the following techniques:

See Also

Creating Collection View Items

- makeItemWithIdentifier:forIndexPath:

Creates or returns a reusable item object of the specified type.

- registerClass:forItemWithIdentifier:

Registers a class to use when creating new items in the collection view.

- registerNib:forItemWithIdentifier:

Registers a nib file to use when creating items in the collection view.

- registerClass:forSupplementaryViewOfKind:withIdentifier:

Registers a class to use when creating new supplementary views in the collection view.

- registerNib:forSupplementaryViewOfKind:withIdentifier:

Registers a nib file to use when creating supplementary views in the collection view.