IOS 어플 리케이션이 있는데, 이는 셀의 수평 그리드를 표시하기 위해 UICollectionView를 사용합니다. 필요한 모든 것은 사용자가 내 UICollectionView가 끝날 때 데이터를로드하는 영리한 방법입니다. 내가 지금 사용하는 코드는 다음과 같습니다이 코드UICollectionView에 대한 지연로드 기술
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
GridCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:Cell forIndexPath:indexPath];
/**
TODO
- Find a good way to check if the user has reach the end of the grid
- This next piece of code is for demonstration purposes. A real check has to be
done yet!!!
**/
// releases is my datasource //
if(indexPath.row == (releases.count - 1)) {
[self getNextListData];
}
return cell; // <-- finally return the cell
}
문제는 : 정말 빨리 끝 부분에 사용자가 스크롤, 그는 스크롤해야하는 경우 앞뒤로 더 많은 항목을로드 할 수 있습니다. 이건 정말 사용자 친화 아니에요 그리고 필요할 때 항목을로드하는 더 나은 방법이 필요합니다.
누구에게 의견이 있습니까? 사전에
감사합니다.
나는 당신이 목록의 카운트를 처음부터 알고 있다고 가정하고있다. – gaige