gpt4 book ai didi

ios7 - UICollectionView + iOS 7/Xcode 5 = 断言失败

转载 作者:行者123 更新时间:2023-12-04 09:31:26 24 4
gpt4 key购买 nike

在我的应用程序中,有一个 UICollectionView 使用 flowLayout,它在 iOS 6 中运行良好,但在 iOS 7 中失败了。一旦我转到包含我的 UICollectionView 的 View ,就会发生以下情况:

*** Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:], /SourceCache/UIKit/UIKit-2903.2/UICollectionView.m:1401
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath
(UICollectionElementKindSectionHeader,<NSIndexPath: 0x145f3f50> {length = 2, path = 0 - 0}) was not retrieved by calling -dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath: or is nil'
(<UICollectionReusableView: 0x145f9400; frame = (0 0; 320 20); layer = <CALayer: 0x145f90c0>>)

最佳答案

当我更新到 iOS 7 时,我遇到了这个问题。问题最终是你不应该对你的数据源如此明确。如果您有以下情况,请将其删除:

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
return nil;
}

关于ios7 - UICollectionView + iOS 7/Xcode 5 = 断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19034098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com