DraggableCollectionView
DraggableCollectionView copied to clipboard
The cell is being dragged should be set to "selected" status if possible.
I have a collection view which can drag and drop cells based on this library, and my cell can be single-selected(like cell border's color change). If I have selected cell A, and then long press cell B to trigger dragging, the selected status can not move from cell A to cell B. In order to resolve this issue, I put some codes like below into LSCollectionViewHelper.m - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender:
NSArray* selectedIndexPathes = self.collectionView.indexPathsForSelectedItems;
for (NSIndexPath* p in selectedIndexPathes)
{
[self.collectionView deselectItemAtIndexPath:p animated:NO];
}
[self.collectionView selectItemAtIndexPath:indexPath animated:NO scrollPosition:UICollectionViewScrollPositionNone];