UICollection View Flow Layout Vertical Align

后端 未结 10 2155
無奈伤痛
無奈伤痛 2021-02-03 21:45

By default, when you are using the flow layout in a collection view, cells are centered vertically. Is there a way to change this alignment ?

10条回答
  •  情话喂你
    2021-02-03 22:06

    I used this code (https://github.com/yoeriboven/TopAlignedCollectionViewLayout) after DongXu's solution didn't quite work. The only modification was that it's originally designed to be used with a grid so I needed to instantiate the layout with an arbitrarily high column count...

    let collectionViewFlowLayout = YBTopAlignedCollectionViewFlowLayout(numColumns: 1000)
    

提交回复
热议问题