Skip to content
Open
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
11 changes: 11 additions & 0 deletions DraggableCollectionView/Helpers/LSCollectionViewHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ - (id)initWithCollectionView:(UICollectionView *)collectionView
initWithTarget:self
action:@selector(handleLongPressGesture:)];
[_collectionView addGestureRecognizer:_longPressGestureRecognizer];
_longPressGestureRecognizer.delegate = self;

_panPressGestureRecognizer = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(handlePanGesture:)];
Expand Down Expand Up @@ -131,6 +132,8 @@ - (void)setupScrollTimerInDirection:(_ScrollingDirection)direction {
}
}

#pragma mark - gesture delegate

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
if([gestureRecognizer isEqual:_panPressGestureRecognizer]) {
Expand All @@ -152,6 +155,14 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni
return NO;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
CGPoint touchPoint = [touch locationInView:_collectionView];
if (![_collectionView indexPathForItemAtPoint:touchPoint]){
return NO;
}
return YES;
}

- (NSIndexPath *)indexPathForItemClosestToPoint:(CGPoint)point
{
NSArray *layoutAttrsInRect;
Expand Down