Ich habe eine Sammlungsansicht und in diesem ersten 3 Artikel sollte statisch sein und danach wird dynamisch hinzufügen.Sammlungsansicht zuerst 3 Artikel sollte statisch sein
Überprüfen Sie meinen Code unten: -
func numberOfSections(in collectionView: UICollectionView) -> Int {
//
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
//
return 20
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
//
// Configure the cell
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier,
for: indexPath) as! AddProductInGroupCell
//cell.backgroundColor = UIColor.white
cell.layer.borderWidth = 0.4
cell.layer.borderColor = UIColor.lightGray.cgColor
cell.layer.cornerRadius = 2
if(3 > indexPath.row)
{
cell.ProductImage.image = UIImage(named : "folder.png")
cell.lableProduct.text = arrCellsLabel[indexPath.row]
cell.imageDotted.isHidden = true
cell.imageLike.isHidden = true
}
cell.delegate = self
return cell
}
wenn die App laufen, Zum ersten Mal es kommt richtig (3 statische Zellen), aber wenn wir nach unten scrollen und kommt nach wieder, dass 5 Zellen statisch zeigt.
Was ist zu tun? Dank
Ihr Zustand ist falsch Bruder –
Warum Bedingung falsch ist? – kishor0011
aber es werden nur zwei angezeigt. – kishor0011