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 JASwipeCell/JASwipeCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ typedef NS_OPTIONS(NSUInteger, JAButtonLocation) {
@class JASwipeCell;

@protocol JASwipeCellDelegate <NSObject>
@optional
// Called when the left most button has swiped all the way to the right.
- (void)leftMostButtonSwipeCompleted:(JASwipeCell *)cell;
// Called when the right most button has swiped all the way to the left.
- (void)rightMostButtonSwipeCompleted:(JASwipeCell *)cell;
@optional
// Called when the user begins swiping right on the cell.
- (void)swipingRightForCell:(JASwipeCell *)cell;
// Called when the user begins swiping left on the cell.
Expand Down
14 changes: 12 additions & 2 deletions JASwipeCell/JASwipeCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr
return self;
}

- (void) awakeFromNib
{
[super awakeFromNib];
[self initialize];
}

- (void)initialize
{
[self addSubview:self.topContentView];
Expand Down Expand Up @@ -435,7 +441,9 @@ - (void)panHandler:(UIPanGestureRecognizer *)recognizer
[UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[self pinButtonToTopViewWithOffset:newXOffset swipeDirection:JASwipeDirectionLeft];
} completion:^(BOOL finished) {
[self.delegate rightMostButtonSwipeCompleted:self];
if ([self.delegate respondsToSelector:@selector(rightMostButtonSwipeCompleted:)]) {
[self.delegate rightMostButtonSwipeCompleted:self];
}
}];
self.rightButtonsRevealed = NO;
}
Expand Down Expand Up @@ -472,7 +480,9 @@ - (void)panHandler:(UIPanGestureRecognizer *)recognizer
[UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
[self pinButtonToTopViewWithOffset:newXOffset swipeDirection:JASwipeDirectionRight];
} completion:^(BOOL finished) {
[self.delegate leftMostButtonSwipeCompleted:self];
if ([self.delegate respondsToSelector:@selector(leftMostButtonSwipeCompleted:)]) {
[self.delegate leftMostButtonSwipeCompleted:self];
}
}];
self.leftButtonsRevealed = NO;
}
Expand Down