欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS UINavigationController 修改默认的动画

程序员文章站 2022-09-28 11:34:51
iOS UINavigationController 修改默认的动画。 1.添加QuartzCore并引入头文件 #import 2. PushView 的动画修改 CAT...

iOS UINavigationController 修改默认的动画。

1.添加QuartzCore并引入头文件

#import

2. PushView 的动画修改

CATransition*transition=[CATransitionanimation];

transition.duration=1;

transition.timingFunction=[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type=kCATransitionPush;

transition.subtype=kCATransitionFromTop;

transition.delegate=self;

[self.navigationController.view.layeraddAnimation:transitionforKey:nil];

self.navigationController.navigationBarHidden=NO;

[self.navigationControllerpushViewController:viewControlleranimated:NO];

3.popView的动画

CATransition*transition=[CATransitionanimation];

transition.duration=0.4;

transition.timingFunction=[CAMediaTimingFunctionfunctionWithName:kCAMediaTimingFunctionEaseInEaseOut];

transition.type=kCATransitionReveal;

//transition.subtype=kCATransitionFromBottom;

transition.delegate=self;

[self.navigationController.view.layeraddAnimation:transitionforKey:nil];

self.navigationController.navigationBarHidden=NO;

[self.navigationControllerpopViewControllerAnimated:NO];