lxcid / LXReorderableCollectionViewFlowLayout

Extends `UICollectionViewFlowLayout` to support reordering of cells. Similar to long press and pan on books in iBook.

Home Page:http://lxcid.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

*** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit_Sim/UIKit-2935.137/UICollectionView.m:3840

caiguo37 opened this issue · comments

  • (void)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath willMoveToIndexPath:(NSIndexPath *)toIndexPath
    I did something wrong in this delegate method.

I am also experiencing this issue when I invoke this method:

  • (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {

    NSLog(@"BEFORErally %lu", (unsigned long)[topRowArray count]); // logs 30

    [topRowArray addObject:@{@"profile_ID":@"1235",
    @"name":@"monk",
    @"avatar":@"1235_image"
    }];

    NSLog(@"AFTERrally %lu", (unsigned long)[topRowArray count]); // logs 31
    NSLog(@"ItemCount %lu", (long)[_topHorizontalLane numberOfItemsInSection:0]); /// logs 30

    [_topHorizontalLane insertItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:[topRowArray count]-1 inSection:0]]]; // invoking this triggers the exception

2014-06-05 13:26:29.724 around[11277:60b] *** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit_Sim/UIKit-2935.137/UICollectionView.m:3840
2014-06-05 13:26:29.728 around[11277:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (31) must be equal to the number of items contained in that section before the update (31), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).'

Any help and direction on how to inset would be greatly appreciated