Reputation: 93
I can't seem to find any solution to following bug. I'm using collection view in usual UIViewController, and using new ios9 feature for interactive reordering. Also I define where i can move picked cell using targetIndexPathForMoveFromItemAtIndexPath:.
The bug is when the targetIndex is not visible in collectionView, moving cell leaves duplicate of itself in place, where touch ended. Please see bug scrren shot here. The gray cell are not allowed to be placed between pink cells and it should be placed after last gray cell which is not visible cause it's in the beginning of view.
I also use wiggle animation for reordering taken from this article. https://littlebitesofcocoa.com/104-interactive-collection-view-re-ordering
If you need code where i define my gesture recognizer, here it is
if (gesture.state==UIGestureRecognizerStateBegan){
NSIndexPath *selectedIndexPath = [self.collectionView indexPathForItemAtPoint:[gesture locationInView:self.collectionView]];
if(!selectedIndexPath)
return;
movingIndexPath=selectedIndexPath;
[self setEditing:YES];
[self.collectionView beginInteractiveMovementForItemAtIndexPath:selectedIndexPath];
TLTimelineCollectionCell *pickedCell=[self pickedUpCell];
movingCollectionCell=pickedCell;
[pickedCell stopWiggling];
[self animatePickingUpCell:pickedCell];
UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForItemAtIndexPath:selectedIndexPath];
CGRect cellRect = attributes.frame;
CGRect rect=[self.collectionView convertRect:cellRect toView:self.collectionView];
} else if (gesture.state==UIGestureRecognizerStateChanged) {
[self.collectionView updateInteractiveMovementTargetPosition:CGPointMake([gesture locationInView:gesture.view].x,39)];
} else {
if (gesture.state==UIGestureRecognizerStateEnded) {
[self.collectionView endInteractiveMovement];
} else {
[self.collectionView cancelInteractiveMovement];
}
[self animatePuttingDownCell:movingCollectionCell];
movingIndexPath=nil;
movingCollectionCell=nil;
[self setEditing:NO];
}
Appreciate any help, thank you!
UPDATE
Found out that this bug also happens without any "wiggle animations" in clear project with just one collection view controller
Upvotes: 0
Views: 563