है, मेरे पास एक सामान्य UICollectionView है जो UICollectionViewFlowLayout को लंबवत फैशन में उपयोग कर रहा है। मैं संग्रह दृश्य को पॉप्युलेट करने के लिए पेजिनेशन के साथ एक बाकी एपीआई का उपयोग कर रहा हूं। जब मैं मैं चलानेUICollectionView अनुभाग में डालने वाले मुद्दे जिनमें एक पाद लेख
-(void)loadNextPageOfAssets{
__weak RDRadiusGridViewController *weakSelf = self;
// Increment page and request assets. They are added to cluster.assets before the completion block is called.
self.cluster.pagination.page++;
[self.cluster requestAssetsWithCompletionBlock:^(NSArray *assets) {
SM_LOG_DEBUG(@"page.total: %ld assets.count: %ld", self.cluster.pagination.totalCount, (long)assets.count);
NSMutableArray *indexPaths = [[NSMutableArray alloc]initWithCapacity:assets.count];
for(NSUInteger index = 0; index < assets.count; index++){
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.cluster.assets.count - assets.count + index inSection:0];
SM_LOG_DEBUG(@"Inserting indexPath: %ld:%ld", (long)indexPath.item, (long)indexPath.section);
[indexPaths addObject:indexPath];
}
[weakSelf.collectionView performBatchUpdates:^{
[weakSelf.collectionView insertItemsAtIndexPaths:indexPaths];
} completion:^(BOOL finished) {
}];
// [weakSelf.collectionView reloadData];
}];
}
: आदेश डाउनलोड करने के लिए अगले पृष्ठ को गति प्रदान करने में, मैं प्रतिनिधि उपयोग कर रहा हूँ जब यह पाद लेख लेआउट के लिए पूछता है:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
RDLoadMoreReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"RDLoadMoreReusableView" forIndexPath:indexPath];
view.delegate = self;
[view start];
[self loadNextPageOfAssets];
return view;
}
यहाँ मेरी loadNextPageOfAssets पीछे कोड है मेरे व्यू कंट्रोलर पर जा सकते हैं और लोड की गई संपत्तियों का पहला पृष्ठ देख सकते हैं। अगर मैं नीचे स्क्रॉल मैं पाद लेख दृश्य (जो एक स्पिनर शामिल हैं) देखेंगे, लेकिन उसके बाद कोड लाइन में अपवाद को तोड़ने बिंदु पर टूट जाएगा:
[weakSelf.collectionView insertItemsAtIndexPaths:indexPaths];
अभिकथन विफलता में - [UICollectionViewData layoutAttributesForSupplementaryElementOfKind: atIndexPath:] , /SourceCache/UIKit/UIKit-3185.20/UICollectionViewData.m:829
फिर अगर मैं जारी रखने के लिए यह त्रुटि के साथ दुर्घटनाओं:
2014-06-11 16: 39: 58.335 त्रिज्या-iOS [ 4 9 01: 525006] * ऐप को समाप्त करना न आया हुआ अपवाद 'NSInternalInconsistencyException', कारण: '-layoutAttributesForSupplementaryElementOfKind के लिए कोई UICollectionViewLayoutAttributes उदाहरण: पथ पर UICollectionElementKindSectionFooter {लंबाई = 2, पथ = 0 - 0}' * पहले फेंक कॉल स्टैक:
यह puzzling है मुझे। layoutAttributesForSupplementaryElementOfKind लगता है कि यह लेआउट क्लास के साथ करने के लिए कुछ है, लेकिन मैं एक कस्टम प्रवाह लेआउट का उपयोग नहीं कर रहा बल्कि डिफ़ॉल्ट आपूर्ति की जा रहा हूं। ऐसा लगता है जैसे ऐप्पल का कोड पागल है लेकिन मुझे लगता है कि मैं सब कुछ ठीक से उपयोग कर रहा हूं।
[self loadNextPageOfAssets];
अनुपूरक सेल विपंक्ति से UICollectionViewCell Deque तेह के लिए, और सभी को एक साथ पाद लेख दृश्य हटाने के लिए, तो डालने महान काम करता है:
अब अगर मैं कॉल चलते हैं।
अभी के लिए मैं सम्मिलित करने के बजाय reloadData को कॉल कर रहा हूं, लेकिन यह UGLY है।
क्या मैं पाद लेखों के बारे में कुछ देख रहा हूं?
wel .. शुरुआत आप जांच कर सकता है पूरक तत्व तरह कि viewForSupplementaryElementOfKind में पारित हो जाता – govi