Justify last line of UICollectionView

前端 未结 2 1899
渐次进展
渐次进展 2020-12-03 18:08

As far as I can see, UICollectionViewFlowLayout justifies all the lines of a section except the last one. So for example, if there aren\'t enough items to fill

2条回答
  •  悲哀的现实
    2020-12-03 18:35

    You can do this by subclassing UICollectionViewFlowLayout and overriding layoutAttributesForElementsInRect: and layoutAttributesForItemAtIndexPath: to place all the items in the last line (except the first, which is already correct) where you want them, by changing the frame property of the item's UICollectionViewLayoutAttributes object.

提交回复
热议问题