UICollectionView, simply fit cell to width?

前端 未结 3 1710
予麋鹿
予麋鹿 2020-12-14 06:20

Here\'s a simple UICollectionView in yellow

\"enter

The red arrow sets the wid

3条回答
  •  轮回少年
    2020-12-14 07:22

    I think you need to take a look at

    - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
    

    of UICollectionViewLayout where you can set size based on orientation and current frame.


    It would indeed seem that you simply have to do this in code.

提交回复
热议问题