如何更改UINavigationController推送过渡样式? [英] How do I change the UINavigationController push transition style?

查看:52
本文介绍了如何更改UINavigationController推送过渡样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用导航控制器,并按segues来控制我的应用程序的流程.无论如何,是否可以为推送顺序从右到左更改默认动画?我可以在某处覆盖某些内容吗?

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?

谢谢

推荐答案

我做了以下工作,它工作正常..而且简单易懂..

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];

与推送相同.

别忘了包含QuartCore(#import)

don't forget to include QuartCore (#import )

这篇关于如何更改UINavigationController推送过渡样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆