diff --git a/ACSideslipTransition/ACSideslipTransition/ACSideslipConstants.h b/ACSideslipTransition/ACSideslipTransition/ACSideslipConstants.h index 369a171..d954d1a 100755 --- a/ACSideslipTransition/ACSideslipTransition/ACSideslipConstants.h +++ b/ACSideslipTransition/ACSideslipTransition/ACSideslipConstants.h @@ -20,4 +20,6 @@ static CGFloat const ACST_SwipeShouldFinishDismissPercent = 0.5; static CGFloat const ACST_SwipeFinishDismissDuration = 0.1 / ACST_SwipeShouldFinishDismissPercent; static CGFloat const ACST_SwipeCancleDismissDuration = 0.3 / ACST_SwipeShouldFinishDismissPercent; +#import "UIViewController+ACSideslip.h" + #endif diff --git a/ACSideslipTransition/ACSideslipTransition/ACSideslipDismissAnimation.m b/ACSideslipTransition/ACSideslipTransition/ACSideslipDismissAnimation.m index 522c208..13d650d 100644 --- a/ACSideslipTransition/ACSideslipTransition/ACSideslipDismissAnimation.m +++ b/ACSideslipTransition/ACSideslipTransition/ACSideslipDismissAnimation.m @@ -105,7 +105,9 @@ - (void)animateTransition:(id )transitionC } completion:^(BOOL finished) { self.blackMask.hidden = YES; self.shadowMask.hidden = YES; + [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; + [backVC ac_removeTransitionObject]; }]; } diff --git a/ACSideslipTransition/ACSideslipTransition/ACSideslipSwipeInteractiveTransition.m b/ACSideslipTransition/ACSideslipTransition/ACSideslipSwipeInteractiveTransition.m index b1289d0..2fb3dc6 100644 --- a/ACSideslipTransition/ACSideslipTransition/ACSideslipSwipeInteractiveTransition.m +++ b/ACSideslipTransition/ACSideslipTransition/ACSideslipSwipeInteractiveTransition.m @@ -312,7 +312,9 @@ - (void)finishTranslationAnimationWithDuration:(NSTimeInterval)duration } completion:^(BOOL finished) { self.blackMask.hidden = YES; self.shadowMask.hidden = YES; + [self.context completeTransition:YES]; + [backVC ac_removeTransitionObject]; }]; if (self.finishDelegate && [self.finishDelegate respondsToSelector:@selector(swipeInteractiveTransitionDidFinished)]) diff --git a/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.h b/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.h index 8362a18..cd0008b 100644 --- a/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.h +++ b/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.h @@ -18,4 +18,6 @@ - (void)ac_sideslip:(UIViewController * __nonnull)newVC completion:(void (^ __nullable)(void))completion; +- (void)ac_removeTransitionObject; + @end diff --git a/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.m b/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.m index 3ce2428..5767316 100644 --- a/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.m +++ b/ACSideslipTransition/ACSideslipTransition/UIViewController+ACSideslip.m @@ -30,8 +30,24 @@ - (void)ac_sideslip:(UIViewController * __nonnull)newVC completion:(void (^ __nu [sideslipTransitionObject sideslip:newVC from:self completion:completion]; } +- (void)ac_removeTransitionObject { + ACSideslipTransition *sideslipTransitionObject = [self ac_sideslipTransitionObject]; + if (sideslipTransitionObject) { + objc_setAssociatedObject(self, + kACSideslipTransitionObjectKey, + nil, + OBJC_ASSOCIATION_RETAIN_NONATOMIC); + sideslipTransitionObject = nil; + } +} + #pragma mark - Associated Properties +- (ACSideslipTransition *)ac_sideslipTransitionObject { + ACSideslipTransition *sideslipTransitionObject = objc_getAssociatedObject(self, kACSideslipTransitionObjectKey); + return sideslipTransitionObject; +} + - (void)ac_setSideslipTransitionObject:(ACSideslipTransition *)sideslipTransitionObject { objc_setAssociatedObject(self, kACSideslipTransitionObjectKey, @@ -39,9 +55,6 @@ - (void)ac_setSideslipTransitionObject:(ACSideslipTransition *)sideslipTransitio OBJC_ASSOCIATION_RETAIN_NONATOMIC); } -- (ACSideslipTransition *)ac_sideslipTransitionObject { - ACSideslipTransition *sideslipTransitionObject = objc_getAssociatedObject(self, kACSideslipTransitionObjectKey); - return sideslipTransitionObject; -} + @end diff --git a/ACSideslipTransition/SecondViewController.m b/ACSideslipTransition/SecondViewController.m index c31a0a4..0e36859 100644 --- a/ACSideslipTransition/SecondViewController.m +++ b/ACSideslipTransition/SecondViewController.m @@ -19,6 +19,11 @@ @interface SecondViewController ()