iDeveloper iDeveloper - 1 year ago 198
Swift Question

How to fill data right to left in UICollectionView

I am trying to fill data from right to left, because i am designing an Arabic app. and i know it write from right to left. So how to do it?

Like This:

Desired result


Answer Source

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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download