Instance Method

registerClass:forSupplementaryViewOfKind:withReuseIdentifier:

Registers a class for use in creating supplementary views for the collection view.

Declaration

- (void)registerClass:(Class)viewClass forSupplementaryViewOfKind:(NSString *)elementKind withReuseIdentifier:(NSString *)identifier;

Parameters

viewClass

The class to use for the supplementary view.

elementKind

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

identifier

The reuse identifier to associate with the specified class. This parameter must not be nil and must not be an empty string.

Discussion

Prior to calling the dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath: method of the collection view, you must use this method or the registerNib:forSupplementaryViewOfKind:withReuseIdentifier: method to tell the collection view how to create a supplementary view of the given type. If a view of the specified type is not currently in a reuse queue, the collection view uses the provided information to create a view object automatically.

If you previously registered a class or nib file with the same element kind and reuse identifier, the class you specify in the viewClass parameter replaces the old entry. You may specify nil for viewClass if you want to unregister the class from the specified element kind and reuse identifier.

See Also

Creating Collection View Cells

- registerClass:forCellWithReuseIdentifier:

Register a class for use in creating new collection view cells.

- registerNib:forCellWithReuseIdentifier:

Register a nib file for use in creating new collection view cells.

- registerNib:forSupplementaryViewOfKind:withReuseIdentifier:

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

- dequeueReusableCellWithReuseIdentifier:forIndexPath:

Returns a reusable cell object located by its identifier

- dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:

Returns a reusable supplementary view located by its identifier and kind.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software