From 7b3b0e0030d83ad38308abd796bd5c56c87a8a78 Mon Sep 17 00:00:00 2001 From: mplackowski Date: Fri, 20 Jun 2014 20:56:15 +0200 Subject: [PATCH] reloading cells fix didMoteItemAtIndexPath was placed after invalidateLayout methods. Cells are reloading properly now --- DraggableCollectionView/Helpers/LSCollectionViewHelper.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/DraggableCollectionView/Helpers/LSCollectionViewHelper.m b/DraggableCollectionView/Helpers/LSCollectionViewHelper.m index 77929f6..d666d05 100644 --- a/DraggableCollectionView/Helpers/LSCollectionViewHelper.m +++ b/DraggableCollectionView/Helpers/LSCollectionViewHelper.m @@ -271,9 +271,6 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender self.layoutHelper.toIndexPath = nil; } completion:^(BOOL finished) { if (finished) { - if ([dataSource respondsToSelector:@selector(collectionView:didMoveItemAtIndexPath:toIndexPath:)]) { - [dataSource collectionView:self.collectionView didMoveItemAtIndexPath:fromIndexPath toIndexPath:toIndexPath]; - } } }]; @@ -290,6 +287,12 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender mockCell = nil; self.layoutHelper.hideIndexPath = nil; [self.collectionView.collectionViewLayout invalidateLayout]; + + if ([dataSource respondsToSelector:@selector(collectionView:didMoveItemAtIndexPath:toIndexPath:)]) { + [dataSource collectionView:self.collectionView didMoveItemAtIndexPath:fromIndexPath toIndexPath:toIndexPath]; + }else{ + [self.collectionView reloadData]; + } }]; // Reset