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

自我名

在我的应用程序中,有一个使用flowLayout的UICollectionView,它在iOS 6中运行良好,但在iOS 7中却无法正常运行。一旦我选择包含UICollectionView的视图,就会发生以下情况:

*** 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时,我遇到了这个问题。问题最终是您不应该对dataSource这么明确。如果满足以下条件,请将其删除:

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

XCode iOS-断言失败

来自分类Dev

PhoneGap / Cordova + iOS7 + XCode 5

来自分类Dev

Xcode 5-iOS7 UITableView的更改

来自分类Dev

Landscape Apps Xcode 5 / iOS 7

来自分类Dev

XCode 5和iOS 6和7

来自分类Dev

iOS 7-CoreData迁移-Xcode 5

来自分类Dev

XCode 5和iOS 6和7

来自分类Dev

iOS静态库未链接XCODE 5 iOS 7

来自分类Dev

UICollectionView _createPreparedCellForItem中的断言失败

来自分类Dev

createPreparedCellForItemAtIndexPath 中的 UICollectionView 断言失败

来自分类Dev

Xcode 7 UI测试-断言失败:UI测试失败-等待启动目标应用程序的超时

来自分类Dev

Xcode5 iOS7-UIPopoverController角半径

来自分类Dev

Sizes and names on icons and launch images in Xcode 5, ios 7

来自分类Dev

Xcode 5 // iOS 6和7 // TDD:OCUnit或XCTest

来自分类Dev

iOS 5,6和7的UI的方法-Xcode

来自分类Dev

Is Xcode 5 Asset Catalog backwards compatible with pre-iOS 7?

来自分类Dev

Is Xcode 5 Asset Catalog backwards compatible with pre-iOS 7?

来自分类Dev

Xcode 5 iOS 7-UIScrollView行为异常

来自分类Dev

Xcode 5 iOS 7中的自动属性综合警告

来自分类Dev

使用Xcode 5在iOS 7中启动图像

来自分类Dev

在Xcode 5 / iOS 7中搜索没有文本的UISearchBar

来自分类Dev

仪器显示内存泄漏-Xcode 5 / iOS7

来自分类Dev

iOS 7 / Xcode 5:以编程方式访问设备启动图像

来自分类Dev

使用XCode 5在iOS 7中启动图像

来自分类Dev

Xcode 5 iOS7-太多的ScriptAgent进程

来自分类Dev

Xcode 5 iOS7-太多的ScriptAgent进程

来自分类Dev

svprogresshud未在xcode5 ios7中显示

来自分类Dev

iOS7和Xcode5中的MRC

来自分类Dev

使用xcode 5(iOS7sdk)构建非iOS7 UI