I have a collectionView with multiple cells. I was wondering if it is possible to stop the top section(section 0) from scrolling while allowing the rest of the sections to continue to scroll. All of the answers I have seen talks about enabling or disabling the entire collection view to scroll. In my case I want the collectionView to scroll, except I want section 0 to not scroll at all. Is this possible or do I have to have two separate collectionViews?
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
var reusableview = UICollectionReusableView()
if (kind == UICollectionView.elementKindSectionHeader) {
let section = indexPath.section
switch (section) {
case 0:
let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: headerIdentifier, for: indexPath) as? Header
case 1:
let Section1 = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: Section1, for: indexPath) as? Section
case 2:
let Section2 = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: Section2, for: indexPath) as? Section2
case 3:
let Section3 = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: Section3, for: indexPath) as? Section3
case 4:
let Section4 = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: Section4, for: indexPath) as? Section4
default:
return reusableview
}
}
return reusableview
}