[英]How can I use custom UIViewController transitions to achieve this?
So I have a flow in my app where all the view controllers have the same gradient background (using a UIImageView). 因此,我的应用程序中存在一个流程,其中所有视图控制器具有相同的渐变背景(使用UIImageView)。
I'm presenting each of them modally with a cross-dissolve transition as opposed to using a navigation controller because I don't want the horizontal push/pop transition. 与使用导航控制器相反,我为每个模型都提供了交叉溶解过渡,因为我不希望水平推送/弹出过渡。 Is there a better way to do this?
有一个更好的方法吗? Perhaps using a navigation controller and disabling the push/pop animation and just fading/pushing the UI elements into the view?
也许使用导航控制器并禁用推/弹出动画,而只是将UI元素淡入/推入视图中?
I want it to look like the background never changes through the workflow, but the ui elements/contents for each view controller do change. 我希望它看起来像背景在整个工作流程中都不会改变,但是每个视图控制器的ui元素/内容都会改变。
You could provide a custom push / pop animation, if the animation is fairly easy to do.: 如果该动画非常容易实现,则可以提供自定义的推送/弹出动画。
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[self.navigationController pushViewController:nextView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
}];
[self.navigationController popViewControllerAnimated:NO];
If the animation isn't so easy, it's perfectly fine to present your view controllers modally if you don't need the navigation bar, but you'll have to provide your own popToViewController:animated:
equivalent (since I don't know any way to dismiss more than one view controller). 如果动画不太容易,那么如果不需要导航栏,最好以模态方式显示视图控制器,但是您必须提供自己的
popToViewController:animated:
等效项(因为我不知道解除多个视图控制器的方式)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.