Created
September 1, 2017 14:56
-
-
Save olexale/adcfe6c530b664b0e143b7a91dd99914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TransitionAnimator : UIViewControllerAnimatedTransitioning | |
{ | |
private const double _duration = 0.5; | |
public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext) | |
{ | |
var containerView = transitionContext.ContainerView; | |
var toView = transitionContext.GetViewFor(UITransitionContext.ToViewKey); | |
containerView.AddSubview(toView); | |
toView.Alpha = 0; | |
UIView.Animate(_duration, () => | |
{ | |
toView.Alpha = 1; | |
}, () => | |
{ | |
transitionContext.CompleteTransition(true); | |
}); | |
} | |
public override double TransitionDuration(IUIViewControllerContextTransitioning transitionContext) | |
{ | |
return _duration; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment