diff --git a/MCSwipeTableViewCell/MCSwipeTableViewCell.h b/MCSwipeTableViewCell/MCSwipeTableViewCell.h index 3cc5591..8687406 100644 --- a/MCSwipeTableViewCell/MCSwipeTableViewCell.h +++ b/MCSwipeTableViewCell/MCSwipeTableViewCell.h @@ -57,7 +57,7 @@ typedef void (^MCSwipeCompletionBlock)(MCSwipeTableViewCell *cell, MCSwipeTableV @interface MCSwipeTableViewCell : UITableViewCell /** Delegate of `MCSwipeTableViewCell` */ -@property (nonatomic, assign) id delegate; +@property (nonatomic, weak) id delegate; /** * Damping of the physical spring animation. Expressed in percent. @@ -179,6 +179,11 @@ typedef void (^MCSwipeCompletionBlock)(MCSwipeTableViewCell *cell, MCSwipeTableV */ - (void)triggerState1; +/** + * Trigger state 1 as if the user had swiped and released, and specify the animation duration + */ +- (void)triggerState1WithDuration:(NSTimeInterval)duration; + @end diff --git a/MCSwipeTableViewCell/MCSwipeTableViewCell.m b/MCSwipeTableViewCell/MCSwipeTableViewCell.m index 41ca849..227c7cb 100644 --- a/MCSwipeTableViewCell/MCSwipeTableViewCell.m +++ b/MCSwipeTableViewCell/MCSwipeTableViewCell.m @@ -645,7 +645,11 @@ - (void)swipeToOriginWithCompletion:(void(^)(void))completion { #pragma mark - Trigger Manually - (void)triggerState1 { - [UIView animateWithDuration:0.15f animations:^{ + [self triggerState1WithDuration:0.15]; +} + +- (void)triggerState1WithDuration:(NSTimeInterval)duration { + [UIView animateWithDuration:duration animations:^{ [self animateSliderWithXTranslation:-70.f animationDuration:0 hasEnded:NO]; } completion:^(BOOL finished) { [self animateSliderWithXTranslation:0.f animationDuration:0 hasEnded:YES];