Jaba Jaba - 2 years ago 64
iOS Question

How to change the Push and Pop animations in a navigation based app

I have a navigation based application and I want to change the animation of the push and pop animations. How would I do that?

Answer Source

I did the following and it works fine.. and is simple and easy to understand..

CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
//transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[[self navigationController] popViewControllerAnimated:NO];

And the same thing for push..

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download