Change direction of push transition animation to left

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Change direction of push transition animation to left

stackflower
When I open a specific view, I want to change the direction of the slide animation to --> from right to left instead of the default direction (left to right).

I found a solution to change the animation transition. Although this is a flip animation and I want to change the direction of the default slide animation of a navigation controller.

var screen = new Screen();
NavigationController.PushViewController(screen, false);

UIView.BeginAnimations(null,IntPtr.Zero);
UIView.SetAnimationDuration(0.75);
UIView.SetAnimationTransition(UIViewAnimationTransition.FlipFromLeft , NavigationController.View,true); // <-- Change the animation
UIView.CommitAnimations();
Reply | Threaded
Open this post in threaded view
|

Re: Change direction of push transition animation to left

c0ld
Hello. Was same problem. There is no normal solution for this. PushViewController is limited by the standard animation(type of UIViewAnimationTransition). If you want to change them, try this:

NavigationController.PushViewController(screen, false);
var theAnimation = CABasicAnimation.FromKeyPath("transform.translation.x");
theAnimation.Duration = 0.6f;
theAnimation.From = NSNumber.FromFloat(-NavigationController.View.Frame.Width);
theAnimation.To = NSNumber.FromFloat(0f);
NavigationController.View.Layer.AddAnimation(theAnimation, "animate");
NavigationController.View.Layer.AnimationForKey("animate");

But it is not perfect, try and u see why. Also u can use PresentViewController. It have some other standart animations in UIModalTransitionStyle:

this.NavigationController.PresentViewController(new UINavigationController(screen){
        ModalTransitionStyle= UIModalTransitionStyle.CoverVertical,
}, true,null);
Reply | Threaded
Open this post in threaded view
|

Re: Change direction of push transition animation to left

Nic Wise
I've done this by pre-pushing a view controller - ie, my stack looks like:

Tax
Overview
Detail

the user starts at Overview. They can go back to tax, or forward to detail....



On 22 March 2013 05:56, c0ld <[hidden email]> wrote:

> Hello. Was same problem. There is no normal solution for this.
> PushViewController is limited by the standard animation(type of
> UIViewAnimationTransition). If you want to change them, try this:
>
> NavigationController.PushViewController(screen, false);
> var theAnimation = CABasicAnimation.FromKeyPath("transform.translation.x");
> theAnimation.Duration = 0.6f;
> theAnimation.From =
> NSNumber.FromFloat(-NavigationController.View.Frame.Width);
> theAnimation.To = NSNumber.FromFloat(0f);
> NavigationController.View.Layer.AddAnimation(theAnimation, "animate");
> NavigationController.View.Layer.AnimationForKey("animate");
>
> But it is not perfect, try and u see why. Also u can use
> PresentViewController. It have some other standart animations in
> UIModalTransitionStyle:
>
> this.NavigationController.PresentViewController(new
> UINavigationController(screen){
>         ModalTransitionStyle= UIModalTransitionStyle.CoverVertical,
> }, true,null);
>
>
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/Change-direction-of-push-transition-animation-to-left-tp4658087p4658173.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [hidden email]
> http://lists.ximian.com/mailman/listinfo/monotouch



--
Nic Wise
t.  +44 7788 592 806 | @fastchicken
b. http://www.fastchicken.co.nz/
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch