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 SWTableViewCell/PodFiles/SWCellScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>

@interface SWCellScrollView : UIScrollView <UIGestureRecognizerDelegate>

@property (assign, nonatomic) BOOL panDisabled;
@end
3 changes: 3 additions & 0 deletions SWTableViewCell/PodFiles/SWCellScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ @implementation SWCellScrollView
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer == self.panGestureRecognizer) {
if (self.panDisabled) {
return NO;
}
CGPoint translation = [(UIPanGestureRecognizer*)gestureRecognizer translationInView:gestureRecognizer.view];
return fabs(translation.y) <= fabs(translation.x);
} else {
Expand Down
1 change: 1 addition & 0 deletions SWTableViewCell/PodFiles/SWTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef NS_ENUM(NSInteger, SWCellState)

@interface SWTableViewCell : UITableViewCell

@property (nonatomic, assign) BOOL swipeDisabled;
@property (nonatomic, copy) NSArray *leftUtilityButtons;
@property (nonatomic, copy) NSArray *rightUtilityButtons;

Expand Down
12 changes: 11 additions & 1 deletion SWTableViewCell/PodFiles/SWTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @interface SWTableViewCell () <UIScrollViewDelegate, UIGestureRecognizerDelegat
@property (nonatomic, assign) SWCellState cellState; // The state of the cell within the scroll view, can be left, right or middle
@property (nonatomic, assign) CGFloat additionalRightPadding;

@property (nonatomic, strong) UIScrollView *cellScrollView;
@property (nonatomic, strong) SWCellScrollView *cellScrollView;
@property (nonatomic, strong) SWUtilityButtonView *leftUtilityButtonsView, *rightUtilityButtonsView;
@property (nonatomic, strong) UIView *leftUtilityClipView, *rightUtilityClipView;
@property (nonatomic, strong) NSLayoutConstraint *leftUtilityClipConstraint, *rightUtilityClipConstraint;
Expand Down Expand Up @@ -531,6 +531,16 @@ - (BOOL)isUtilityButtonsHidden {

#pragma mark - Geometry helpers

- (void)setSwipeDisabled:(BOOL)swipeDisabled
{
_cellScrollView.panDisabled = swipeDisabled;
}

- (BOOL)swipeDisabled
{
return _cellScrollView.panDisabled;
}

- (CGFloat)leftUtilityButtonsWidth
{
#if CGFLOAT_IS_DOUBLE
Expand Down