2014-07-24 11:50:15.925 *** Assertion failure in -[UICollectionViewData layoutAttributesForSupplementaryElementOfKind:atIndexPath:], /SourceCache/UIKit/UIKit-2935.137/UICollectionViewData.m:787
2014-07-24 11:50:15.927 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no UICollectionViewLayoutAttributes instance for -layoutAttributesForSupplementaryElementOfKind: UICollectionElementKindSectionFooter at path <NSIndexPath: 0xc000000000000016> {length = 2, path = 0 - 0}'
i have this error message occurs when i scrolling my collection view and i totally loss in mind how could this happen ? any suggestion to help are thankful.
The register
[self.collectionView registerClass:[CollectionViewFooter class]
forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"CollectionViewFooter"];
The Delegate Method
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
//declare the reusable view of header and footer
UICollectionReusableView *reusableview = nil;
CollectionViewFooter *footer=nil;
if([kind isEqual:UICollectionElementKindSectionFooter])
{
footer = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"CollectionViewFooter" forIndexPath:indexPath];
//attach the footer to reusable view
reusableview = footer;
}
return reusableview;
}
Check by break point, error occur when reach to line
[self.collectionView performBatchUpdates:^{