Ios -[UICollectionViewData LayoutAttributes中的断言失败,该属性适用于种类:atIndexPath:]
我在集合视图中遇到此错误。 我已经实现了这个方法,并返回最后一节的页脚Ios -[UICollectionViewData LayoutAttributes中的断言失败,该属性适用于种类:atIndexPath:],ios,objective-c,iphone,ios8,ios7.1,Ios,Objective C,Iphone,Ios8,Ios7.1,我在集合视图中遇到此错误。 我已经实现了这个方法,并返回最后一节的页脚 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { if (section == LAST_SECTION_INDEX) {
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
{
if (section == LAST_SECTION_INDEX)
{
return CGSizeMake(self.view.width, 50);
}
return CGSizeZero;
}
在viewforsupplementalelementofkind
方法中,我实现了这样的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 LayoutAttributes中的断言失败,该属性适用于种类:atIndexPath:]
我被困在这里了。有人能帮忙吗
谢谢。在
dequeueReusableSupplementaryViewOfKind:kind