This is what I have now (by default):
but I would like to have:
I display it using NSFetcheResultsController
with descending order for my property.
I faced the same problem, after searching for any possible built-in feature that let me able to do this easily, -unfortunately- I couldn't find such a thing. I had to solve it by my self by doing this trick:
For the purpose of demonstration, I will present this -ugly- collectionView and show you how it should changes:
The main idea of the trick is Mirroring! by changing the scaleX to -1.
Let's mirror the whole collection view:
P.S: Swift 3 code.
If you don't have an IBOutlet for your collectionView, create one. In my case im calling it collectionView
In viewController:
override func viewDidLoad() {
super.viewDidLoad()
collectionView.transform = CGAffineTransform(scaleX: -1, y: 1)
}
Now, it should look like this:
"What the heck?!"
So far so good, in fact this is exactly what you are looking for, but you still need to add another mirroiring mechanism for each cell content.
In your custom cell's class:
override func awakeFromNib() {
super.awakeFromNib()
contentView.transform = CGAffineTransform(scaleX: -1, y: 1)
}
Now it should look like this:
Hope it helped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With