我使用 CSStickyHeaderFlowLayout 创建了 UICollectionView ,因为我想为 UICollectionView 及其各个部分分别设置标题。它正在成功显示数据,但是当我向上或向下滚动时,一旦触及顶部或底部边界,它就会崩溃,发出以下错误,我只是想要单独的Headers用于集合视图及其部分,就像我们在UITableView中一样。如果有人可以帮助解决这个问题或指出一些替代方案。
2016-12-06 11:50:51.881 TestStickyHeader [899:18365] *断言失败 - [UICollectionViewData validateLayoutInRect:],/ BuildRoot / Library / Cache / com.apple.xbs / Source / 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有效:YES kind:UICollectionElementKindSectionHeader到indexPath:{9,0} zIndex:1024有效:YES kind:UICollectionElementKindSectionHeader没有使布局无效' ***第一次抛出调用堆栈: ( 0 CoreFoundation 0x0000000104cbb34b exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010471c21e objc_exception_throw + 48 2 CoreFoundation 0x0000000104cbf442 + [NSException raise:format:arguments:] + 98 3基础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_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类型的未捕获异常终止