From 4b63c1736d618b42c295a26f0f618afddd9be27c Mon Sep 17 00:00:00 2001 From: Armand van der Walt Date: Thu, 26 Mar 2015 09:30:00 +0200 Subject: [PATCH] Added ability to implement delegate methods that notifies when scroll has ended and the state of the cell, this allows for implementations where you would want to execute a command when scrolling ends --- SWTableViewCell/PodFiles/SWTableViewCell.h | 2 +- SWTableViewCell/PodFiles/SWTableViewCell.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/SWTableViewCell/PodFiles/SWTableViewCell.h b/SWTableViewCell/PodFiles/SWTableViewCell.h index 10d9fab..80922e8 100644 --- a/SWTableViewCell/PodFiles/SWTableViewCell.h +++ b/SWTableViewCell/PodFiles/SWTableViewCell.h @@ -32,7 +32,7 @@ typedef NS_ENUM(NSInteger, SWCellState) - (BOOL)swipeableTableViewCell:(SWTableViewCell *)cell canSwipeToState:(SWCellState)state; - (void)swipeableTableViewCellDidEndScrolling:(SWTableViewCell *)cell; - (void)swipeableTableViewCell:(SWTableViewCell *)cell didScroll:(UIScrollView *)scrollView; - +- (void)swipeableTableViewCell:(SWTableViewCell *)cell didSwipeToState:(SWCellState) state; @end @interface SWTableViewCell : UITableViewCell diff --git a/SWTableViewCell/PodFiles/SWTableViewCell.m b/SWTableViewCell/PodFiles/SWTableViewCell.m index 3daceac..847d0d2 100644 --- a/SWTableViewCell/PodFiles/SWTableViewCell.m +++ b/SWTableViewCell/PodFiles/SWTableViewCell.m @@ -778,7 +778,10 @@ -(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL) { self.tapGestureRecognizer.enabled = YES; } - + if(self.delegate && [self.delegate respondsToSelector:@selector(swipeableTableViewCell:didSwipeToState:)]) + { + [self.delegate swipeableTableViewCell:self didSwipeToState:self.cellState]; + } } #pragma mark - UIGestureRecognizerDelegate