BeginAnimations and CommitAnimations with NavigationController.PushViewController

I am trying to get a basic flip animation transition when I press the controller inside the navigation. The code below rotates the view, however, the view first appears (each element disappears), and then the switch happens. Is it possible to make flip animation using UINavigationController?

Any pointers would be great, the examples I found for Monotouch do the animation on the views in 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();
    }
}
+3
source share
2 answers

I was kind of there, but View needs to be taken from NavigationController:

// Push the controller first or the Title doesn't animate
NavigationController.PushViewController(controller,false);

UIView.BeginAnimations(null,IntPtr.Zero);
UIView.SetAnimationDuration(1);
UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromLeft,
                              NavigationController.View,true);
UIView.CommitAnimations();
+4
source

, , TRUE PushViewcontroller , . , , NavigationController , . false, ? , TRUE , .

0

Source: https://habr.com/ru/post/1738857/


All Articles