我使用method described here使用旧的(iOS7之前)推/动画动画:
@implementation UINavigationController (Retro)
- (void)pushViewControllerRetro:(UIViewController *)viewController {
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[self.view.layer addAnimation:transition forKey:nil];
[self pushViewController:viewController animated:NO];
}
- (void)popViewControllerRetro {
CATransition *transition = [CATransition animation];
transition.duration = 0.25;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[self.view.layer addAnimation:transition forKey:nil];
[self popViewControllerAnimated:NO];
}
@end
我的问题是iOS7在推送新视图控制器时似乎淡化了前一个视图控制器的UINavigationBar
。通常这看起来很好,因为iOS 7将视图拖到彼此之上。但是当我使用iOS7之前的动画时,它会给我一个短暂的闪光,因为导航栏会在新视图从右侧推入时消失。
有没有办法在导航栏上禁用淡入淡出动画?