Aligning right to left on UICollectionView

前端 未结 13 677
悲哀的现实
悲哀的现实 2020-12-02 08:31

this is a pretty straightforward question, but I haven\'t been able to find a definitive answer to it on SO (if I missed it, please correct me).

Basically, my quest

13条回答
  •  不知归路
    2020-12-02 09:04

    By changing both flipsHorizontallyInOppositeLayoutDirection and developmentLayoutDirection, I was able to achieve a full screen RTL scroll where the first item was all the way to the right, and to reach the last cell, user will need to scroll to the left.

    Like so:

    class RTLCollectionViewFlowLayout: UICollectionViewFlowLayout {
    
        override var flipsHorizontallyInOppositeLayoutDirection: Bool {
            return true
        }
    
        override var developmentLayoutDirection: UIUserInterfaceLayoutDirection {
            return UIUserInterfaceLayoutDirection.rightToLeft
        }
    }
    

提交回复
热议问题