Dan.code
Dan.code

Reputation: 441

Having one Main sticky Header with Multiple Sections of UICollection views? Xcode - Swift

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

Answers (1)

Kishan Bhatiya
Kishan Bhatiya

Reputation: 2368

You can use collection view's collectionView:viewForSupplementaryElementOfKind:atIndexPath: and if it is flow layout use also referenceSizeForHeaderInSection

Upvotes: 1

Related Questions