0

I am loading images from api in my collection view in my iOS app.I want to load first 10 images from api(sending PageNo = 1 as param).After that while scrolling my collectionview I want to call that api with pageNo = 2 param.Then it will give another 10 images.So totally I have to show 20 images.Please give me some suggestion.Here is my code

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) ->UICollectionViewCell
{
   if indexPath.row == arrayProducts.count - 1
    {
        loadNextPage(collectionView, forIndexPath: indexPath)
    }
}
 internal func loadNextPage(view: UICollectionView, forIndexPath indexPath: NSIndexPath){
    self.collectionFooter.hidden = false;
    self.pageNumber! = self.pageNumber! + 1
    self.getProductsByCategoryId()//this is my api call,
}
rmaddy
  • 307,833
  • 40
  • 508
  • 550
Madhumitha
  • 3,734
  • 8
  • 28
  • 42

0 Answers0