UICollectionView iOS 9 issue on project with RTL languages support

前端 未结 5 2122
礼貌的吻别
礼貌的吻别 2020-12-14 00:49

It seems like Apple\'s new feature of auto-flip interface on RTL languages cause problems when using UICollectionView.

I used constraints of type Traili

5条回答
  •  没有蜡笔的小新
    2020-12-14 01:28

    I was in a similar situation and found a solution for this. If you are using swift, add the following snippet to your project, and it will make sure that the bounds.origin always follows leading edge of the collection view.

    extension UICollectionViewFlowLayout {
    
        open override var flipsHorizontallyInOppositeLayoutDirection: Bool {
            return true
        }
    }
    

    If you are using Objective-C, just subclass the UICollectionViewLayout class, and override flipsHorizontallyInOppositeLayoutDirection, and return true. Use this subclass as the layout object of your collection view.

提交回复
热议问题