【发布时间】:2014-09-28 03:16:32
【问题描述】:
我遇到了这个崩溃:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'no UICollectionViewLayoutAttributes instance for
-layoutAttributesForSupplementaryElementOfKind: UICollectionElementKindSectionHeader
at path <NSIndexPath: 0x147b09e0> {length = 2, path = 0 - 0}'
这里是performBatchUpdates:
// Reload just the indexPath that loaded
[UIView animateWithDuration:0 animations:^{
[self.collectionView performBatchUpdates:^{
[self.collectionView reloadItemsAtIndexPaths:paths];
} completion:nil];
}];
我正在使用UICollectionViewFlowLayout:
UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
_collectionViewLayout = layout;
我不明白为什么会这样。我正在重新加载我的一个项目单元格,它指的是补充视图(这是一个标题视图)。
编辑
跟下面的有关系吗?
如果我在- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 中注销indexPath,我会接到第一个电话:
-[WSImageViewerController collectionView:cellForItemAtIndexPath:] [Line 318] indexPath = <NSIndexPath: 0x16d5c990> {length = 2, path = 0 - 0}
调用- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath 的indexPath 日志是:
-[WSImageViewerController collectionView:viewForSupplementaryElementOfKind:atIndexPath:] [Line 399] indexPath = <NSIndexPath: 0x15691570> {length = 2, path = 0 - 0}
两个 indexPath 都是 0 - 0。跟这个有关系吗?
编辑两个
这是崩溃时发生的情况。它试图在标题视图上加载常规项目单元格。中间有一个很大的UIActivityIndicatorView,是从补充的header view里来的,所以我知道已经添加了。
【问题讨论】:
标签: objective-c uicollectionview