From 518d954d5a5e59f3f82b7541a2a1e34da8b766fe Mon Sep 17 00:00:00 2001 From: Aung Thar Date: Mon, 12 Feb 2018 12:37:24 -0800 Subject: [PATCH] Add extra offset when navcontroller is in a tabbar controller --- Classes/SSWAnimator.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Classes/SSWAnimator.m b/Classes/SSWAnimator.m index e265ec9..2fa0386 100644 --- a/Classes/SSWAnimator.m +++ b/Classes/SSWAnimator.m @@ -53,7 +53,13 @@ - (void)animateTransition:(id)transitionCo // parallax effect; the offset matches the one used in the pop animation in iOS 7.1 CGFloat toViewControllerXTranslation = - CGRectGetWidth([transitionContext containerView].bounds) * 0.3f; toViewController.view.bounds = [transitionContext containerView].bounds; - toViewController.view.center = [transitionContext containerView].center; + //Extra offset if the navigation controller is inside a tabbar controller + CGFloat yCenterOffset = 0; + if (toViewController.tabBarController != nil) { + yCenterOffset = CGRectGetMaxY(toViewController.navigationController.navigationBar.frame); + } + + toViewController.view.center = CGPointMake([transitionContext containerView].center.x, [transitionContext containerView].center.y + yCenterOffset); toViewController.view.transform = CGAffineTransformMakeTranslation(toViewControllerXTranslation, 0); // add a shadow on the left side of the frontmost view controller