From c0fb9eaf2d34aa01dd19bf1ff52ccf229640dc98 Mon Sep 17 00:00:00 2001 From: Alexey Novikov Date: Tue, 12 Jul 2016 14:49:52 +0200 Subject: [PATCH 1/2] Fixed swipe cell being stuck in a semi-revealed state. (Issue #6) --- .../PodFiles/UITableViewCell+Swipe.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m b/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m index 2754cc0..f8484b0 100644 --- a/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m +++ b/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m @@ -299,12 +299,6 @@ - (void)goToDefaultMode:(void (^)(BOOL finished))completion withAnimation:(BOOL) - (void)panGesture:(UIPanGestureRecognizer *)recognizer { CGPoint translation = [recognizer translationInView:recognizer.view]; - if (translation.x > 0 && self.leftView == nil) { - return; - } - if (translation.x < 0 && self.rightView == nil) { - return; - } void (^initializeGestureRecognizerBeginningState)(void) = ^{ self.contentView.clipsToBounds = YES; @@ -507,6 +501,12 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer if (gestureRecognizer == self.panGestureRecognizer) { CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:gestureRecognizer.view]; if (translation.y == 0) { + if (translation.x > 0 && self.leftView == nil) { + return NO; + } + if (translation.x < 0 && self.rightView == nil) { + return NO; + } return YES; } return NO; From 857e079cb102f75c81088606afa4937a6d91f5b8 Mon Sep 17 00:00:00 2001 From: Alexey Novikov Date: Wed, 13 Jul 2016 09:21:36 +0200 Subject: [PATCH 2/2] Made comparison condition non-strict to prevent unwanted swipe allowance. --- YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m b/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m index f8484b0..d482b35 100644 --- a/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m +++ b/YMSwipeTableViewCell/PodFiles/UITableViewCell+Swipe.m @@ -500,11 +500,11 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer if (gestureRecognizer == self.panGestureRecognizer) { CGPoint translation = [(UIPanGestureRecognizer *)gestureRecognizer translationInView:gestureRecognizer.view]; - if (translation.y == 0) { - if (translation.x > 0 && self.leftView == nil) { + if (translation.y == 0.f) { + if (translation.x >= 0.f && self.leftView == nil) { return NO; } - if (translation.x < 0 && self.rightView == nil) { + if (translation.x <= 0.f && self.rightView == nil) { return NO; } return YES;