-2
我有一個自定義集合視圖在Viewcontroller中,每當我的集合視圖加載時總是讓我的第一個單元格爲空。如何刪除這個空單元格。集合視圖有第一個單元格總是空的
//CollectionView functions
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return collectionData.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! collectionCell
let collectionData = self.collectionData[indexPath.row]
cell.NameLbl.text = collectionData["name"] as? String
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let Info: NSDictionary = self.collectionData[indexPath.item] as! NSDictionary
let vc = self.storyboard?.instantiateViewController(withIdentifier: "edit") as! editVC
self.navigationController?.pushViewController(vc, animated: false)
}
到目前爲止顯示您的嘗試代碼? –
所有數據都是動態的?顯示您的collectionview數據源Logic – vivek
是您檢查了您的數據源嗎? – Jaydeep