UICollectionView and Supplementary View (header)

前端 未结 10 1352
南旧
南旧 2021-02-04 05:17

Trying to add a a Supplementary view into my UICollectionView as a header. I\'m having issues getting it to work.

I use a custom UICollectionViewFlowL

10条回答
  •  南旧
    南旧 (楼主)
    2021-02-04 05:41

    I kept getting the same error. I had set up the CustomHeaderView for my collectionView. I had class of the Collection Reusable View to my CustomHeaderView and i had set the identifier. I 1/2 an hour trying to figure out why this was failing.

    Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindSectionFooter with identifier SectionHeader - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'

    You need to read the logs carefully...lesson learned.

    'could not dequeue a view of kind: UICollectionElementKindSectionFooter

    The reason is because In storyboard - in the collectionView Identity Inspector I had checked both Accessories: Section Header and Section Footer. I only needed section header. Simply uncheck footer...build and run..BOOM!

提交回复
热议问题