I'm currently trying to get a left alignement on my Collection View. I'm using a FlowLayout because I need the EstimatedSize property that allows me to resize the cell (the labels inside don't always have the same width). Here's the code :
itemCollectionView.collectionViewLayout .invalidateLayout()
if let flowLayout = itemCollectionView.collectionViewLayout as? UICollectionViewFlowLayout {
flowLayout.estimatedItemSize = CGSize(width: 150, height: 35)
flowLayout.sectionInset = UIEdgeInsetsMake(8, 8, 0, 8)
flowLayout.minimumInteritemSpacing = 0
I'm trying to set the left inset to 8 but it doesn't work, it centers the element. With multiple elements, it does the same and create horrible gaps betweens cells.
Thank you for your help !
Fixed it with the TagCellLayout pod : https://github.com/riteshhgupta/TagCellLayout