How do I change the UINavigationController push transition style?

Deadly 提交于 2019-12-21 12:39:29

问题


I am using a navigation controller and push segues to control the flow of my app. Is there anyway to change the default animation of right-to-left for the push segues? Is there something I can overwrite somewhere?

Thanks


回答1:


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..

don't forget to include QuartCore (#import )




回答2:


Yes , you can changes transition style of ViewController with different animation. see below link.

  1. transition style animation

  2. ViewController transition

  3. Custom ViewController transition

  4. ADTransitionController

  5. transition

  6. ViewController T




回答3:


You can create an NSObject class and subclass it from UIStoryboardSegue and then override the -(void)perform function to give it your own custom animations. There you can use any animations either pre-defined or your own. For details, checkout this link.



来源:https://stackoverflow.com/questions/28023528/how-do-i-change-the-uinavigationcontroller-push-transition-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!