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 situation, can somebody tell me what should I do , thanks!
问问题
13040 次
2 回答
22
您可以简单地在内部实现获取操作 -
(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
并检查情况
if(indexPath.row==your_array.count-1).
于 2013-09-03T08:44:49.400 回答
15
您也可以使用滚动视图委托,因为 uicollectionview 继承自 uiscrollview ,只需实现 uiscrollview 委托方法:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
并执行以下操作:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (scrollView.contentOffset.y == scrollView.contentSize.height - scrollView.frame.size.height)
{
//LOAD MORE
// you can also add a isLoading bool value for better dealing :D
}
}
于 2013-12-11T17:14:19.220 回答