I have a UICollectionView with random cells. Is there any method that allows me to center rows?
UICollectionView
This is how it looks by default:
[ x x x x x x ] [ x x x x x x ] [ x x ]
Here is what the desired layout looks like:
[ x x x x x ] [ x x x x x ] [ x x ]
I had to do something like this, but needed all the cells in the one section. It was pretty simple to extend UICollectionViewFlowLayout to center cells. I made a pod:
UICollectionViewFlowLayout
https://github.com/keighl/KTCenterFlowLayout
1.4m articles
1.4m replys
5 comments
56.9k users