我有一个名为ListaFotos
的UICollectionView。这应该显示没有边距的项目,我使用函数ConfigurarCollectionView()
更改布局并且它没有显示左侧和右侧的边距,但是当加载第三个项目时,两个第一项之间有空格第三个。图片下来更好地解释了我的问题,代码也是如此。
//Listas
@IBOutlet weak var ListaFotos: UICollectionView!
//MARK: - ViewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
self.ListaFotos.delegate = self
self.ListaFotos.dataSource = self
ConfigurarCollectionView()
}
//MARK: - CollectionView Config
func ConfigurarCollectionView(){
let CVLayOut = UICollectionViewFlowLayout()
CVLayOut.minimumLineSpacing = 0
CVLayOut.minimumInteritemSpacing = 0
CVLayOut.scrollDirection = .vertical
CVLayOut.itemSize.width = self.ListaFotos.frame.size.width/2
CVLayOut.itemSize.height = self.ListaFotos.frame.size.width/2
CVLayOut.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0)
self.ListaFotos.collectionViewLayout = CVLayOut
}