-1

Edited

I am using custom collection cells to load in collectionview. But when the collection view loadeds expecting behaviour cellforindex delegate will call for 3 indexpath but in this case only calling 0th indexpath 3 time.

    override func viewDidLoad()
    {
        super.viewDidLoad()
        let nib = UINib(nibName: "cellName", bundle: nil)
        self.collectionvView?.register(nib, forCellWithReuseIdentifier: "cellId")
    }

    func numberOfSections(in collectionView: UICollectionView) -> Int
    {
        return 1
    }

    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
    {
       return 10
    }

    func collectionView(_ collectionView: UICollectionView,
              cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
    {
        print("indexpath.row ----------------- ",indexPath.row)

        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellId",for: indexPath) as! DetailCollectionViewCell
         return cell

    }
Anju
  • 563
  • 2
  • 6
  • 13

1 Answers1

0

Check All This

  1. self.arrIds.count = 3
  2. numberOfSections = 1
  3. numberOfItemsInSection
  4. cellForItemAt
Yash Gotecha
  • 144
  • 3