我正在使用UICollectionViewDelegateFlowLayout
委托使其成为方形,但最后显示出奇怪的间距。
我的代码
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if collectionView == self.bannerClcView {
let cellSize = CGSize.init(width: view.frame.size.width, height: view.frame.size.height)
return cellSize
}else if collectionView == self.category {
let cellSize = CGSize.init(width: (self.category.frame.size.width/3), height: category.frame.size.width/3)
return cellSize
}else {
let cellSize = CGSize.init(width: (recomended_Ads_Clc.frame.size.width/2), height: 220)
return cellSize
}
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
如何删除间距?请帮忙。