I tried with the following question:
Aligning right to left on UICollectionView but it's not achieved my goal.
What I was tried:
In viewDidLoad()
:
collectionView.transform = CGAffineTransform(scaleX: -1.0, y: 1.0)
In cellForItemAtIndexPath()
:
cell.transform = CGAffineTransform(scaleX: -1.0, y: 1.0)
My current CollectionView
is on the left, but I want it to look like the CollecitonView
on the right.
dataSource = ["item1","item2","item3","item4","item5","item6"]
Update:
Change semanticContentAttribute
of the collectionView
to .forceRightToLeft
collectionView.semanticContentAttribute = .forceRightToLeft
by @RajeshKumar answered
I notice. items has spacing too much between two element for example item1
and item2
How can i reduce that the space and rest of things? ok for me. on the other hand I tried with layout.minimumInteritemSpacing = 0
but it is not worked for me and item3
not alinement right too.
In viewDidLoad():
@Hemang comment worked for me.
If you have any subviews in your cell, then you have transform it as well. For e.g.
AlignedCollectionViewFlowLayout
Change
semanticContentAttribute
of the collectionView to .forceRightToLeftIt works