「var product」配列を取得して、最初の UICollectionViewcell 「newCell」の後にセルの入力を開始しようとしています。newCell は常に同じように表示され、常に存在します。productCell の名前とラベルは異なる場合があり、常に存在するとは限りません。画像「製品」の配列は拡大し続け、現在 2 番目の項目を見ることができますが、最初の画像は newCell コレクション ビュー セルによってブロックされています。
var products: [itemCellContent] = {
var eggs = itemCellContent()
eggs.itemName = "Eggs"
eggs.itemImageName = "eggs"
eggs.Quantity = "1"
var Toast = itemCellContent()
Toast.itemName = "Bread"
Toast.itemImageName = "bread"
Toast.Quantity = "5"
return [eggs, Toast]
}()
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if indexPath.item == 0
{
let newCell = collectionView.dequeueReusableCell(withReuseIdentifier: addCellID, for: indexPath) as! addProductCell
print("Rounds corners")
return newCell
} else {
let productCell = collectionView.dequeueReusableCell(withReuseIdentifier: cellID, for: indexPath) as! productCellLayout
productCell.backgroundColor = UIColor.rgb(red: 252, green: 252, blue: 252) //off white blue color
productCell.layer.cornerRadius = 5
print("Rounds corners")
productCell.gItem = products[indexPath.item]
//collectionview.insertIems(at: indexPaths)
//Shadow
productCell.layer.shadowColor = UIColor.gray.cgColor
productCell.layer.shadowOffset = CGSize(width: 0, height: 3.0)
productCell.layer.shadowOpacity = 0.7
productCell.layer.shadowRadius = 2.0
productCell.layer.masksToBounds = false
productCell.layer.shadowPath = UIBezierPath(roundedRect: productCell.bounds, cornerRadius: productCell.contentView.layer.cornerRadius).cgPath;
return productCell
}
}
誰かが「var product」配列を取得して、2番目のセルを入力できる最初のセルとして認識するのを手伝ってくれるなら、私に何ができるか教えてください。
これは、コードを実行したときに表示されるものです。 これは、私が見たいものです。
ありがとう!