I have a UICollectionView
contains cell
and header
. I have 4 sections each section has 3 or 5 cell. My issue is the section header won’t stick until I get to the next section header as in the TableView
. Please where would be my issue?
My code:
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 4
}
func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView
{
let header = collectionView.dequeueReusableSupplementaryViewOfKind(UICollectionElementKindSectionHeader, withReuseIdentifier: "headersection", forIndexPath: indexPath) as! MenuHeaderCollectionViewCell
header.headerTitle.text = collectionheader[indexPath.row]
return header
}