Header not showing
MarcoMig opened this issue · 4 comments
Hello,
I have follows all the precedures to show the header but is not working.
Here what I've done:
- Added the method viewForSupplementaryElementOfKind
- Added the flow.headerHeight property.
If I run the project with this options the app will crash within the "viewForSupplementaryElementOfKind" method.
To fix this error I had to register my header view in my viewDidLoad:
self.collectionView?.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: CHTCollectionElementKindSectionHeader,withReuseIdentifier: "collectionHeader")
Now the app don't crash but as a result now I see a blank header.
Hi @MarcoMig,
I'm not sure if this helps, but I had success using a nib approach:
let nib = UINib(nibName: "HeaderCollectionReusableView", bundle: nil)
self.collectionView?.register(nib, forSupplementaryViewOfKind: CHTCollectionElementKindSectionHeader, withReuseIdentifier: "collectionHeader")
Don't forget to conform to protocol CHTCollectionViewDelegateWaterfallLayout.
func collectionView (collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout,
heightForHeaderInSection section: NSInteger) -> CGFloat
deinit {
SDWebImageDownloader.shared.cancelAllDownloads()
}
Thanks @pippo27