Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DraggableCollectionView.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "DraggableCollectionView"
s.version = "0.1.3"
s.version = "0.1.4"
s.summary = "Extension for the UICollectionView and UICollectionViewLayout that allows a user to move items with drag and drop."
s.homepage = "https://github.com/lognllc/DraggableCollectionView"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
20 changes: 12 additions & 8 deletions DraggableCollectionView/Helpers/LSCollectionViewHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ - (id)initWithCollectionView:(UICollectionView *)collectionView
initWithTarget:self action:@selector(handlePanGesture:)];
_panPressGestureRecognizer.delegate = self;
[_collectionView addGestureRecognizer:_panPressGestureRecognizer];

for (UIGestureRecognizer *gestureRecognizer in _collectionView.gestureRecognizers) {
if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
[gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer];
break;
}
}

// iOS 10 comment out to support drag and drop
// for (UIGestureRecognizer *gestureRecognizer in _collectionView.gestureRecognizers) {
// if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
// [gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer];
// break;
// }
// }

[self layoutChanged];
}
Expand Down Expand Up @@ -321,7 +322,10 @@ - (void)handleLongPressGesture:(UILongPressGestureRecognizer *)sender

- (void)warpToIndexPath:(NSIndexPath *)indexPath
{
if(indexPath == nil || [lastIndexPath isEqual:indexPath]) {
if( indexPath == nil
|| [ lastIndexPath isEqual: indexPath ]
|| indexPath.item > [ self.collectionView numberOfItemsInSection: indexPath.section ] - 1 )
{
return;
}
lastIndexPath = indexPath;
Expand Down