In this recipe, we will create an app that displays a view controller modally but with our own custom-animated transition.
Create a new Single View Application in Xamarin Studio and name it CustomTransitionApp
. Add another view controller to the project and name it ModalController
. Finally, we will need a button on each of these controllers.
Add the following classes to the project:
public class MyTransitionAnimator : UIViewControllerAnimatedTransitioning { public bool IsPresenting { get; set; } public override double TransitionDuration (IUIViewControllerContextTransitioning transitionContext) { return 1; } public override void AnimateTransition (IUIViewControllerContextTransitioning transitionContext) { if (this.IsPresenting) { UIView containerView = transitionContext.ContainerView; UIViewController toViewController = transitionContext.GetViewControllerForKey(UITransitionContext...