How to fill data right to left in UICollectionView
Creation of a custom UICollectionViewFlowLayout
maybe is the most straight answer, but it's too expensive.
I always rather use this way (Flip the collectionView
and it's subviews).
Inside init
or viewDidLoad()
put this:
self.collectionView.transform = CGAffineTransformMakeScale(-1, 1)
Inside collectionView:cellForItemAtIndexPath:
or cell class put this:
cell.transform = CGAffineTransformMakeScale(-1, 1)
EDIT:
You can make your app completely RTL by doing the following:
- Set the minimum deployment target version to iOS
9.0
- In your
Info.plist
, setLocalization native development region
to your RTL localization. (Likear_AE
for Arabic orfa_IR
for Persian-Iran)
swift 3
inside collection view cell
cell.transform = CGAffineTransform(scaleX: -1, y: 1)
in viewdidload
self.collectionView.transform = CGAffineTransform(scaleX: -1, y: 1)