在我的uicollectionview单元中,各节中加载了单元格。但是collectionview中的节数是1。当节被破坏时,单元格之间有一个空间我需要避免。
func cellSize() -> CGSize {
let collectionViewSize: CGSize = self.colorScrollCollectionView.frame.size
return CGSize(width: collectionViewSize.width, height: collectionViewSize.width * 0.35)
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.colorArray.count * 5
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let cellSize = CGSize(width: self.cellSize().width, height: self.cellSize().height)
return cellSize
}