4

I can't find a way to manage the spacing between items on a horizontally scrolling UICollectionView using IGListKit 3.1.1.

I tried different approaches...

Using UICollectionViewFlowLayout

I set it like this:

collectionLayout.minimumLineSpacing = 10.0
collectionLayout.minimumInteritemSpacing = 10.0

I also played with the sectionInset, but in vain...

Using ListCollectionViewLayout & custom adapter

I used IGListKit's ListCollectionViewLayout using a custom adapter to implement the UICollectionViewDelegateFlowLayout protocol, but in vain...

What I get

I also end up getting horizontal sections that touch each other (ie a spacing of 0 pt).

Can anyone from IGListKit can help me on this?

The source code for this is available at https://github.com/FlaneurApp/FlaneurOpen/tree/0.3.0 (cf. CollectionView Demo in the example app). The class configuring the collection view is here: https://github.com/FlaneurApp/FlaneurOpen/blob/0.3.0/FlaneurOpen/Classes/Custom%20UIView/FlaneurCollectionView.swift

Thanks.

Mick F
  • 7,312
  • 6
  • 51
  • 98

1 Answers1

4

I had the same problem, solved it using this.

In your section controller, override the initialiser as so:

override init() {
    super.init() 
    let halfCellSpacing = 10
    self.inset = UIEdgeInsets(top: 0, left: halfCellSpacing, bottom: 0, right: halfCellSpacing)
}
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
mistry
  • 459
  • 1
  • 6
  • 16