Stop Single UICollectionView cell Flowing to the centre of the screen

后端 未结 4 1881
名媛妹妹
名媛妹妹 2021-01-11 15:45

I am trying to understand why Collection View keeps centre aligning just the last cell in a collection.
I have created a simple Flow layout based collection view. I am

4条回答
  •  忘掉有多难
    2021-01-11 16:29

    In Swift 5

    Use UICollectionViewFlowLayout to align cell to left like below

    let layout = UICollectionViewFlowLayout()
    layout.scrollDirection = .horizontal
    self.collectionView.collectionViewLayout = layout
    

提交回复
热议问题