2014-10-02 62 views
1

我使用的是PSTCollectionView,它适用于iPhone和iPad2,但在iPad Air中,它在setCollectionViewLayoutprepareLayout中崩溃。PSTCollectionView布局错误

这是错误:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UITableViewCellSeparatorView prepareLayout]: unrecognized selector sent to instance 0x7ff930da9600' 
*** First throw call stack: 
(
    0 CoreFoundation      0x00000001120753f5 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000111d0ebb7 objc_exception_throw + 45 
    2 CoreFoundation      0x000000011207c50d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
    3 CoreFoundation      0x0000000111fd47fc ___forwarding___ + 988 
    4 CoreFoundation      0x0000000111fd4398 _CF_forwarding_prep_0 + 120 
    5 los100primeros      0x000000010f3278f1 -[PSTCollectionViewData prepareToLoadData] + 97 
    6 los100primeros      0x000000010f326aa9 -[PSTCollectionViewData validateLayoutInRect:] + 73 
    7 los100primeros      0x000000010f2790d0 -[PSTCollectionView layoutSubviews] + 592 
    8 UIKit        0x0000000110645199 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521 
    9 QuartzCore       0x000000010ffb0f98 -[CALayer layoutSublayers] + 150 
    10 QuartzCore       0x000000010ffa5bbe _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    11 QuartzCore       0x000000010ffa5a2e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 
    12 QuartzCore       0x000000010ff13ade _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242 
    13 QuartzCore       0x000000010ff14bea _ZN2CA11Transaction6commitEv + 390 
    14 QuartzCore       0x000000010ff15255 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89 
    15 CoreFoundation      0x0000000111faa347 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 
    16 CoreFoundation      0x0000000111faa2a0 __CFRunLoopDoObservers + 368 
    17 CoreFoundation      0x0000000111fa00d3 __CFRunLoopRun + 1123 
    18 CoreFoundation      0x0000000111f9fa06 CFRunLoopRunSpecific + 470 
    19 GraphicsServices     0x0000000113d349f0 GSEventRunModal + 161 
    20 UIKit        0x00000001105cc550 UIApplicationMain + 1282 
    21 los100primeros      0x000000010f3740f3 main + 115 
    22 libdyld.dylib      0x00000001126e0145 start + 1 
    23 ???         0x0000000000000001 0x0 + 1 
) 

这是该行的崩溃:

if (CGRectIsEmpty(self.bounds) || !_collectionViewFlags.doneFirstLayout) { 
     _layout.collectionView = nil; 
     _collectionViewData = [[PSTCollectionViewData alloc] initWithCollectionView:self layout:layout]; 
     layout.collectionView = self; // HERE CRASHES 
     _layout = layout; 

     // originally the use method 
     // _setNeedsVisibleCellsUpdate:withLayoutAttributes: 
     // here with CellsUpdate set to YES and LayoutAttributes parameter set to NO 
     // inside this method probably some flags are set and finally 
     // setNeedsDisplay is called 

     _collectionViewFlags.scheduledUpdateVisibleCells = YES; 
     _collectionViewFlags.scheduledUpdateVisibleCellLayoutAttributes = NO; 

     [self setNeedsDisplay]; 

请我需要帮助,我不明白这个问题。感谢您的提前。

编辑1

它崩溃的产品iPad Air,iPhone 5S,iPhone 6和iPhone 6加上iOS的8

回答

0

我的解决方案是使用UICollectionView。

+0

嗨科ova,为了支持ios5,我要使用PSTCollectView吗? – neobie 2015-02-14 15:13:35

+0

我不知道,我总是支持iOS 6,iOS7或iOS8 – amurcia 2015-02-16 08:29:04