UICollectionReusableView method not being called

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

    You answered the question, but in words I understand better:

    To make the method being called, add these methods:

    - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
        return CGSizeMake(60.0f, 30.0f);
    }
    
    - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
        return CGSizeMake(60.0f, 30.0f);
    }
    

    ...and go from there.

提交回复
热议问题