2

我使用CSStickyHeaderFlowLayout 创建了一个 UICollectionView 因为我想为UICollectionView及其部分设置单独的 Header。它成功显示数据,但是当我向上或向下滚动时,一旦它触及顶部或底部边界,它就会崩溃,并给出以下错误,我只需要单独的标题用于集合视图及其部分,就像我们在 UITableView 中一样。如果有人可以帮助解决此问题或指出一些替代方案。

2016-12-06 11:50:51.881 TestStickyHeader[899:18365] * 断言失败 -[UICollectionViewData validateLayoutInRect:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3600.5.2/ UICollectionViewData.m:445 2016-12-06 11:50:51.929 TestStickyHeader[899:18365] *由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“索引路径处补充项目的布局属性({length = 2, path = 9 - 0}) 从 indexPath: {9, 0} zIndex: 1024 valid: YES kind: UICollectionElementKindSectionHeader 更改为 indexPath: {9, 0} zIndex: 1024 valid: YES kind: UICollectionElementKindSectionHeader 而不会使布局失效' *** First抛出调用堆栈:(0 CoreFoundation 0x0000000104cbb34bexceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010471c21e objc_exception_throw + 48 2 CoreFoundation 0x0000000104cbf442 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00000001042b2e4d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 UIKit 0x00000001063f5c3b __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 1436 5 UIKit 0x00000001063f5093 -[UICollectionViewData validateLayoutInRect:] + 2984 6 UIKit 0x00000001063f835e -[UICollectionViewData layoutAttributesForCellsInRect:validateLayout:] + 170 7 UIKit 0x0000000106392909 -[UICollectionView _computePrefetchCandidatesForVisibleBounds:futureVisibleBounds:prefetchVector:notifyDelegateIfNeeded:] + 134 8 UIKit 0x0000000106392877 -[UICollectionView _computePrefetchCandidatesForVelocity:notifyDelegateIfNeeded:] + 214 9 UIKit 0x000000010639278d -[UICollectionView _prefetchItemsForVelocity:maxItemsToPrefetch:invalidateCandidatesOnDirectionChanges:] + 934 10 UIKit 0x000000010639baa7 -[UICollectionView layoutSubviews] + 717 11 UIKit 0x0000000105b12f50 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1237 12 QuartzCore 0x00000001058c5cc4 -[CALayer layoutSublayers] + 146 13 QuartzCore 0x00000001058b9788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 14 QuartzCore 0x00000001058b9606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x0000000105847680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 16 QuartzCore 0x0000000105874767 _ZN2CA11Transaction6commitEv + 475 17 QuartzCore 0x00000001057cfb97 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 CoreFoundation 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION0x00000001058b9788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 14 QuartzCore 0x00000001058b9606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x0000000105847680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 16 QuartzCore 0x0000000105874767 _ZN2CA11Transaction6commitEv + 475 17 QuartzCore 0x00000001057cfb97 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 CoreFoundation 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION0x00000001058b9788 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 14 QuartzCore 0x00000001058b9606 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x0000000105847680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 16 QuartzCore 0x0000000105874767 _ZN2CA11Transaction6commitEv + 475 17 QuartzCore 0x00000001057cfb97 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 CoreFoundation 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x0000000105847680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 16 QuartzCore 0x0000000105874767 _ZN2CA11Transaction6commitEv + 475 17 QuartzCore 0x00000001057cfb97 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 CoreFoundation 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x0000000105847680 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 280 16 QuartzCore 0x0000000105874767 _ZN2CA11Transaction6commitEv + 475 17 QuartzCore 0x00000001057cfb97 _ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 CoreFoundation 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 核心基础 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_ZN2CA7Display11DisplayLink14dispatch_itemsEyyy + 611 18 核心基础 0x0000000104c4d964 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION+ 20 19 CoreFoundation 0x0000000104c4d5f3 __CFRunLoopDoTimer + 1075 20 CoreFoundation 0x0000000104c4d17a __CFRunLoopDoTimers + 250 21 CoreFoundation 0x0000000104c44f01 __CFRunLoopRun + 2065 22 CoreFoundation 0x0000000104c44494 CFRunLoopRunSpecific + 420 23 GraphicsServices 0x0000000109e38a6f GSEventRunModal + 161 24 UIKit 0x0000000105a4e964 UIApplicationMain + 159 25 TestStickyHeader 0x0000000103d9411f main + 111 26 libdyld.dylib 0x000000010b44c68d start + 1 27 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib:以 NSException 类型的未捕获异常终止

4

0 回答 0