我在集合视图中收到此错误。 我已经实现了这个方法,我将为最后一节返回一个页脚。
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
if (section == LAST_SECTION_INDEX)
{
return CGSizeMake(self.view.width, 50);
}
return CGSizeZero;
}
并且在viewForSupplementaryElementOfKind
方法中我实现了这样CollectionViewFooter
是UICollectionReusableView
类的子类
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
CollectionViewFooter *footer = [self.collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:FooterIdentifier forIndexPath:indexPath];
return footer;
}
当集合视图重新加载时,它会崩溃并给我这个错误。
断言失败 - [UICollectionViewData layoutAttributesForSupplementaryElementOfKind:atIndexPath:]
我被困在这里。有人可以帮忙吗?
感谢。