DraggableCollectionView
DraggableCollectionView copied to clipboard
LongPress on an empty area of the collectionView causes the app to crash
If the long press is not happening on the cell but on the empty space of the UICollectionView, it causes an NSRangeException.
You can reproduce the bug from the FlowLayoutDemo app.
I also have this problem
Try this:
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row >= [self.items[indexPath.section] count]) {
return NO;
}
return YES;
}
Thanks wiruzx, that solved the problem. It also prevents from selecting a nearby cell if touching empty space which is (usually) the desirable behaviour.
@wiruzx Thanks wiruzx, It was a tremendous help.