首页 > 代码库 > UINavigationController改变动画效果
UINavigationController改变动画效果
@interface UINavigationController (CustomTransition)- (void) pushWithCustomAnimation:(UIViewController *) controller;- (void) popWithCustomAnimation;@end
@implementation UINavigationController (CustomTransition)- (void) pushWithCustomAnimation:(UIViewController *) controller { CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionMoveIn; transition.subtype = kCATransitionFromTop; transition.delegate = self; [self.view.layer addAnimation:transition forKey:nil]; self.navigationBarHidden = NO; [self pushViewController:controller animated:NO];}- (void) popWithCustomAnimation { CATransition *transition = [CATransition animation]; transition.duration =0.3; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionReveal; transition.subtype = kCATransitionFromBottom; transition.delegate = self; [self.view.layer addAnimation:transition forKey:nil]; self.navigationBarHidden = NO; [self popViewControllerAnimated:NO];}@end
UINavigationController改变动画效果
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。