UICollectionView load more data

后端 未结 2 1478
慢半拍i
慢半拍i 2020-12-28 10:36

I want to fetch more data from server if the last cell will display, but UICollectionView don\'t have method -willDisplayCell like UITableview. So I have no idea about this

2条回答
  •  死守一世寂寞
    2020-12-28 10:45

    You can simply implement the fetching operation inside -

      (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
    

    and check for the condition

     if(indexPath.row==your_array.count-1).
    

提交回复
热议问题