BeginAnimations and CommitAnimations with NavigationController.PushViewController

Posted by Chris S on Stack Overflow See other posts from Stack Overflow or by Chris S
Published on 2010-03-28T12:49:45Z Indexed on 2010/03/28 12:53 UTC
Read the original article Hit count: 995

I'm trying to get a basic flip animation transition working when I push a controller inside a navigation. The code below flips the view, however the view appears first (each element fades in), and then the flip occurs. Is it possible to do a flip animation with a UINavigationController?

Any pointers would be great, the examples I've found for Monotouch are performing animations on Views inside another view.

void ToolbarButtonClick()
{
    InformationController controller = new InformationController();
    NavigationController.PushViewController(controller,true);
}

public class InformationController : UIViewController
{
    public override void ViewDidLoad ()
    {
        UIView.BeginAnimations("Flip");
        UIView.SetAnimationDuration(1.0);
        UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromRight,View,true);

        base.ViewDidLoad ();
        Title = "Information";
    }

    public override void ViewWillAppear (bool animated)
    {
        base.ViewWillAppear (animated);
    }

    public override void ViewDidAppear (bool animated)
    {
        base.ViewDidAppear (animated);
        UIView.CommitAnimations();
    }
}

© Stack Overflow or respective owner

Related posts about monotouch

Related posts about beginanimations