Pagination with UICollectionView working with API

前端 未结 1 498
感动是毒
感动是毒 2020-12-12 07:57

I have a working application where I am using Alamofire and SwiftyJSON to fetch images from flicr API. Now, I want to include pagination in the ret

相关标签:
1条回答
  • 2020-12-12 08:52

    Please try this code.

      func scrollViewDidScroll(_ scrollView: UIScrollView) {
       if isGetResponse {
        if (scrollView.contentOffset.y == scrollView.contentSize.height - scrollView.frame.size.height)
        {
            if totalArrayCount! > self.arrImage.count{
    
                    isGetResponse = false
                    activityIndiator?.startAnimating()
                    self.view.bringSubview(toFront: activityIndiator!)
                    pageIndex = pageIndex + 1
                    print(pageIndex)
                    self.getProductListing(withPageCount: pageIndex)
                }
            }
    
            //LOAD MORE
            // you can also add a isLoading bool value for better dealing :D
        }
    }
    
    0 讨论(0)
提交回复
热议问题