Assertion error in - [UICollectionViewData layoutAttributesForSupplementaryElementOfKind: atIndexPath:]
I am getting this error in the collection view. I have implemented this method and I am returning the footer for the last section.
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
if (section == LAST_SECTION_INDEX)
{
return CGSizeMake(self.view.width, 50);
}
return CGSizeZero;
}
and in viewForSupplementaryElementOfKind
which I have implemented like this: CollectionViewFooter
is a subclass of UICollectionReusableView
class
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
CollectionViewFooter *footer = [self.collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:FooterIdentifier forIndexPath:indexPath];
return footer;
}
when data collection reloads it crashes and gives me this error.
Assertion error in - [UICollectionViewData layoutAttributesForSupplementaryElementOfKind: atIndexPath:]
I am stuck here. Can anyone please help?
Thank.
+3
source to share
No one has answered this question yet
Check out similar questions: