我想在集合视图单元格之间用特定颜色(灰色)做分隔线,而不改变集合视图的BG颜色。在这里输入图片描述
你可以在CollectionViewCell里面使用UIView,宽度为1px或2px。
将superview的背景色改为灰色,并在viewDidLoad生命周期方法中使用下面的代码将边缘昆虫添加到collectionView中:-。
private let spacing:CGFloat = 2.0
let layout = UICollectionViewFlowLayout()
layout.sectionInset = UIEdgeInsets(top: spacing, left: spacing, bottom: spacing, right: spacing)
layout.minimumLineSpacing = spacing
layout.minimumInteritemSpacing = spacing
self.collectionView?.collectionViewLayout = layout