恢复 iOS7 之前的 UINavigationController pushViewController 动画 [英] Restore pre-iOS7 UINavigationController pushViewController animation

查看:28
本文介绍了恢复 iOS7 之前的 UINavigationController pushViewController 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以.刚刚开始将我的IOS代码转换到IOS7,遇到了一些问题.

So. Just started transitioning my IOS code to IOS7, and ran into a bit of problem.

我有一个 UINavigationController,它有子 ViewControllers,我使用 pushViewController 来显示下一个视图.要使用一组图像创建视差动画,如果自定义 UINavigationController 为一组 UIImageViews 设置动画,我的子 ViewControllers 都有一个 self.backgroundColor = [UIColor clearColor],透明度.

I've got a UINavigationController, which has child ViewControllers and I'm using pushViewController to display the next views. To create a parallax animation with a set of images, if customized the UINavigationController to animate a set of UIImageViews and my child ViewControllers all have a self.backgroundColor = [UIColor clearColor], transparency.

自 iOS7 以来,UINavController 为其子 vc 设置动画的方式已更新,通过部分移动当前视图控制器并在顶部推动新的视图控制器,我的视差动画看起来很糟糕.我看到之前的 VC 移动了一点然后消失了.有什么办法可以恢复以前的 UINavigationController pushViewController 动画?我似乎在代码中找不到这个.

Since iOS7, the way the UINavController animates it child vc's, is updated, by partially moving the current view controller and on top pushing the new viewcontroller, my parallax animation looks crap. I see the previous VC move a bit and then disappear. Is there any way I can restore the previous UINavigationController pushViewController animation? I can't seem to find this in the code.

WelcomeLoginViewController* welcomeLoginViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WelcomeLogin"];
    [self.navigationController pushViewController:welcomeLoginViewController animated:YES];    

甚至尝试使用:

    [UIView animateWithDuration:0.75
                     animations:^{
                         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                         [self.navigationController pushViewController:welcomeLoginViewController animated:NO];
                         [UIView setAnimationTransition:<specific_animation_form> forView:self.navigationController.view cache:NO];
                     }];

有人知道吗?

推荐答案

感谢大家的反馈.找到了完全重新创建 UINavigationController 行为的解决方案.当我快完成时,我遇到了 Nick Lockwood 的解决方案:

Thanks guys for the feedback. Found a solution in completely recreating the UINavigationController's behavior. When I was nearly finished I ran into Nick Lockwood's solution:

https://github.com/nicklockwood/OSNavigationController

OSNavigationController 是 UINavigationController 的开源重新实现.它目前仅包含 UINavigationController 功能的一个子集,但长期目标是复制 100% 的功能.

OSNavigationController is a open source re-implementation of UINavigationController. It currently features only a subset of the functionality of UINavigationController, but the long-term aim is to replicate 100% of the features.

OSNavigationController 并不是真的要按原样使用.这个想法是,您可以分叉它,然后轻松自定义其外观和行为,以满足您的应用程序可能具有的任何特殊要求.自定义 OSNavigationController 比尝试自定义 UINavigationController 简单得多,因为代码是开放的,您无需担心私有方法、未记录的行为或版本之间的实现更改.

OSNavigationController is not really intended to be used as-is. The idea is that you can fork it and then easily customize its appearance and behaviour to suit any special requirements that your app may have. Customizing OSNavigationController is much simpler than trying to customize UINavigationController due to the fact that the code is open and you don't need to worry about private methods, undocumented behavior, or implementation changes between versions.

通过用他的代码覆盖我的 UINavigationController,我能够在 UINavigationControllers 中处理背景图像

By overriding my UINavigationController with his code, I was able to work with background images in UINavigationcontrollers

谢谢!

这篇关于恢复 iOS7 之前的 UINavigationController pushViewController 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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