How do I set cell spacing in a section of UICollectionView
? I know there is a property minimumInteritemSpacing
I have set it to 5.0 still the spaci
Swift 3 Version
Simply create a UICollectionViewFlowLayout subclass and paste this method.
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let answer = super.layoutAttributesForElements(in: rect) else { return nil }
for i in 1.. previousAttributes.frame.origin.x) {
var frame = currentAttributes.frame
frame.origin.x = origin + maximumSpacing
currentAttributes.frame = frame
}
}
return answer
}