diff --git a/JZSwipeCell/JZSwipeCell.m b/JZSwipeCell/JZSwipeCell.m index 021c622..1214c82 100644 --- a/JZSwipeCell/JZSwipeCell.m +++ b/JZSwipeCell/JZSwipeCell.m @@ -161,6 +161,9 @@ - (SwipeCellColorSet*)defaultColorSet - (void)gestureHappened:(UIPanGestureRecognizer *)sender { CGPoint translatedPoint = [sender translationInView:self]; + if (translatedPoint.x > 0 && !self.allowSwipeRight) return; + if (translatedPoint.x < 0 && !self.allowSwipeLeft) return; + switch (sender.state) { case UIGestureRecognizerStatePossible: @@ -351,6 +354,16 @@ - (BOOL)isLeftSwipeType:(JZSwipeType)type return type == JZSwipeTypeShortLeft || type == JZSwipeTypeLongLeft; } +- (BOOL)allowSwipeRight +{ + return (self.imageSet.longRightSwipeImage || self.imageSet.shortRightSwipeImage); +} + +- (BOOL)allowSwipeLeft +{ + return (self.imageSet.longLeftSwipeImage || self.imageSet.shortLeftSwipeImage); +} + @end @implementation SwipeCellImageSet