UICollectionReusableView method not being called

后端 未结 11 734
暗喜
暗喜 2021-01-31 13:13

I want my sections in the UICollectionView to have a header with an image.

I have followed these steps:

  • at the storyboard, assigned a header a
11条回答
  •  执念已碎
    2021-01-31 13:38

    I have the same issue. I have added referenceSizeForFooterInSection but then also viewForSupplementaryElementOfKind not getting called. I have added this code in viewDidLoad() and it worked for me:

    if let flowLayout = self.collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
        flowLayout.sectionFootersPinToVisibleBounds = true   
    }
    

提交回复
热议问题