public override void Animate(IUIViewControllerContextTransitioning context, UIViewController fromController, UIViewController toController, UIView fromView, UIView toView) { var toViewFrame = new CGRect(toView.Frame.X, toView.Frame.Y, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); if (toView.Frame.Y == 0 && fromView.Frame.Y != 0 && fromView.Frame.Y <= 64) { toViewFrame = new CGRect(toView.Frame.X, fromView.Frame.Y, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); } toView.Frame = toViewFrame; var offsetY = toView.Frame.Y; context.ContainerView.InsertSubview(toView, Reverse ? 0 : 1); var startParamsForFromView = Animation.GetStartUIForDisappearingPage(Reverse); var startParamsForToView = Animation.GetStartUIForAppearingPage(Reverse); var endParamsForFromView = Animation.GetEndUIForDisappearingPage(Reverse); var endParamsForToView = Animation.GetEndUIForAppearingPage(Reverse); fromView.SetUIParams(startParamsForFromView, Reverse); toView.SetUIParams(startParamsForToView, Reverse); SetPivotPoint(toView, startParamsForToView.PivotPointLocation, offsetY); SetPivotPoint(fromView, endParamsForFromView.PivotPointLocation, offsetY); var duration = AnimationHelper.GetDuration(Animation.Duration) / 1000d; if (Animation.BounceEffect && !Reverse) { UIView.AnimateNotify(duration, 0, 0.5f, 0.2f, UIViewAnimationOptions.CurveEaseInOut, () => OnAnimation(toView, fromView, toViewFrame, endParamsForFromView, endParamsForToView, Reverse), new UICompletionHandler((finished) => OnAnimationCompled(context, fromView))); } else { UIView.Animate(duration, 0, UIViewAnimationOptions.CurveEaseInOut, () => OnAnimation(toView, fromView, toViewFrame, endParamsForFromView, endParamsForToView, Reverse), () => OnAnimationCompled(context, fromView)); } }
public override double TransitionDuration(IUIViewControllerContextTransitioning transitionContext) { return(AnimationHelper.GetDuration(Animation.Duration) / 1000d); }