使用分页

时间:2016-08-18 11:41:49

标签: ios pagination uicollectionview

我正在我的iOS应用程序中从我的集合视图中加载来自api的图像。我想从api加载前10个图像(发送PageNo = 1作为参数)。之后滚动我的集合视图时我想用pageNo调用api = 2 param。然后它会再给出10个图像。所以我必须要显示20个图像。请给我一些建议。这是我的代码

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,
}

0 个答案:

没有答案