UICollectionView Set number of columns

后端 未结 17 1172
执笔经年
执笔经年 2020-11-28 17:28

I just started learning about UICollectionViews. I\'m wondering if anyone knows how to specify the number of columns in a collectionview. The default is set to 3 (iPhone/por

17条回答
  •  借酒劲吻你
    2020-11-28 18:13

    Because UICollectionView is so flexible, there are multiple ways you could change the number of columns, depending on the kind of layout you use.

    The UICollectionViewFlowLayout (which is probably what you're working with) doesn't specify a number of columns directly (because it depends on the view size/orientation). The easiest way to change it would be to set the itemSize property and/or minimumInteritemSpacing/minimumLineSpacing.

提交回复
热议问题