UICollectionReusableView method not being called

后端 未结 11 719
暗喜
暗喜 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:55

    There is the swift version :

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
        let size = CGSize(width: 400, height: 50)
        return size
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
        let size = CGSize(width: 400, height: 50)
        return size
    }
    

    XCode (version 7.3.1 ) does not propose these methods in autocomplete !

    If you just want a header, just keep the header method.

提交回复
热议问题