No se muestra el encabezado UICollectionView

Estoy trabajando en un proyecto que usa unUICollectionView para mostrar varios discos. Los elementos se muestran bien, pero ahora quiero mostrar un encabezado sobre la primera sección.

Para ello, he añadido elregisterNib:forSupplementaryViewOfKind:withReuseIdentifier: a mi método de inicio Me gusta esto:

[self.collectionView registerNib:[UINib nibWithNibName:@"AlbumHeader" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:kAlbumHeaderIdentifier];

(LosAlbumHeader Nib contiene una vista de la clase.AlbumHeader, que es una subclase deUICollectionView.)

Después de eso, implementécollectionView:viewForSupplementaryElementOfKind:atIndexPath método:

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
    return [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:kAlbumHeaderIdentifier forIndexPath:indexPath];
}

Ahora debería intentar cargar la vista del encabezado, supongo. Pero no es así, el método para la vista complementaria no se llama.

¿Qué me estoy perdiendo? Atrapado por horas, he leído la documentación enUICollectionViewMuchas veces s, pero nada parece ayudar. ¿Alguna idea?

Respuestas a la pregunta(3)

Su respuesta a la pregunta