Skip to content

Commit 1bc98ce

Browse files
committed
Fixes tableView cell no highlighted effect by setting state correctly
1 parent a8a20f8 commit 1bc98ce

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SWTableViewCell/PodFiles/SWLongPressGestureRecognizer.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
1919
{
2020
[super touchesMoved:touches withEvent:event];
2121

22-
self.state = UIGestureRecognizerStateFailed;
22+
UITouch *touch = touches.anyObject;
23+
if (CGPointEqualToPoint([touch locationInView:touch.view], [touch previousLocationInView:touch.view])) {
24+
self.state = UIGestureRecognizerStateBegan;
25+
} else {
26+
self.state = UIGestureRecognizerStateCancelled;
27+
}
2328
}
2429

2530
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

0 commit comments

Comments
 (0)