Reputation: 441
I've got multiple sections of a UICollectionView, that change from a grid layout to list layout and I'm trying to use a sticky header to pin to the top and have it stay they while scrolling through all the different sections. Is this possible?
Is a function similar to
override func numberOfSections(in collectionView: UICollectionView) -> Int {
return 4
}
That can choose which sections can have a heading and which shouldn't? or have one heading belonging to multiple sections?
Any input would be greatly appreciated!
Cheers
Upvotes: 0
Views: 559
Reputation: 2368
You can use collection view's collectionView:viewForSupplementaryElementOfKind:atIndexPath:
and if it is flow layout use also referenceSizeForHeaderInSection
Upvotes: 1