4

我找不到UICollectionView使用 IGListKit 3.1.1 管理水平滚动项目之间间距的方法。

我尝试了不同的方法...

使用UICollectionViewFlowLayout

我这样设置:

collectionLayout.minimumLineSpacing = 10.0
collectionLayout.minimumInteritemSpacing = 10.0

我也玩过sectionInset,但徒劳...

使用ListCollectionViewLayout& 自定义适配器

我曾经使用自定义适配器IGListKitListCollectionViewLayout实现UICollectionViewDelegateFlowLayout协议,但徒劳无功......

我得到了什么

我最终也得到了相互接触的水平部分(即 0 pt 的间距)。

IGListKit 的任何人都可以帮助我吗?

源代码可在https://github.com/FlaneurApp/FlaneurOpen/tree/0.3.0获得(参见示例应用程序中的CollectionView Demo)。配置集合视图的类在这里:https ://github.com/FlaneurApp/FlaneurOpen/blob/0.3.0/FlaneurOpen/Classes/Custom%20UIView/FlaneurCollectionView.swift

谢谢。

4

1 回答 1

4

我有同样的问题,用这个解决了。

在您的部分控制器中,像这样覆盖初始化程序:

override init() {
    super.init() 
    let halfCellSpacing = 10
    self.inset = UIEdgeInsets(top: 0, left: halfCellSpacing, bottom: 0, right: halfCellSpacing)
}
于 2018-05-04T23:44:30.777 回答