【发布时间】:2013-07-26 13:21:25
【问题描述】:
我正在尝试向 UICollectionView 添加页脚。
以下是我的代码,
UICollectionView是通过IB添加的
IN viewDidLoad 我注册了页脚,
[mCollectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"footer"];
并实现了以下方法
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableview = nil;
if (kind == UICollectionElementKindSectionFooter) {
UICollectionReusableView *headerView = [mCollectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"footer" forIndexPath:indexPath];
[headerView addSubview:mFooterView];
reusableview = headerView;
}
return reusableview;
}
但我的应用程序不断崩溃,下面是日志,
*** -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:] 中的断言失败,/SourceCache/UIKit/UIKit-2380.17/UICollectionView.m:2249
感谢任何帮助。
谢谢。
【问题讨论】:
标签: ios objective-c uicollectionview