UICollectionView Flow layout no fixed row height

后端 未结 1 790
一生所求
一生所求 2021-01-16 11:49

How to modify the flow layout, so that there is the same vertical spacing between the smaller and larger cells (eg. there is no fixed row height / the row height is not fixe

相关标签:
1条回答
  • 2021-01-16 12:34

    The solution was using UICollectionViewWaterfallLayout

    Follow the setup from the website, and you can setup it like this

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        UICollectionViewWaterfallLayout * layout = (UICollectionViewWaterfallLayout *)self.collectionView.collectionViewLayout;
        layout.delegate = self;
        layout.columnCount = 2;
        layout.itemWidth = 150.f;
        layout.sectionInset = UIEdgeInsetsZero;
    
        ...
    }
    
    0 讨论(0)
提交回复
热议问题