I have a UICollectionView and it has a header and a cell.
I want to remove the gap between the header and the cell..
How to do that in swift?
Here is my view...

I added background colour to the collectionView and header and cell also..
Please see the screenshot.

Use the property section Inset of UICollectionViewFlowLayout
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: 0, left: 10, bottom: 10, right: 10)
// Here you can set according your requirement

For more reference: http://www.brianjcoleman.com/tutorial-collection-view-using-swift/
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