UICollectionView with dynamic height not getting same space between cell

后端 未结 6 2038
鱼传尺愫
鱼传尺愫 2021-02-14 03:05

I am having similar problem like this

I am generating height of view at run time.Here is my code

@interface CollectionViewController ()
{
    NSMutableAr         


        
6条回答
  •  执笔经年
    2021-02-14 03:40

    You can set the size with a property:

    flowLayout.headerReferenceSize = CGSizeMake(0, 100);//constant height for all the items header
    

    If Dynamic :

    - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
        if (section == albumSection) {
            return CGSizeMake(0, 100);
        }
    
        return CGSizeZero;
    }
    

提交回复
热议问题