UINavigationController的:向相反的方向弹出视图控制器 [英] UINavigationController: pop view controller in the opposite direction
问题描述
我试图调用 [自我navigationController] popViewControllerAnimated:YES]
但是制作到左,而不是从左到右动画幻灯片的权利。任何简单的方法来做到这一点?我想回到previous视图。任何帮助是AP preciated。谢谢!
I'm trying to call [[self navigationController] popViewControllerAnimated:YES]
but making the animation slide right to left instead of left to right. Any easy way to do this? I want to return to the previous view. Any help is appreciated. Thanks!
推荐答案
这是可能的,看看下面code我用了一段时间后,并尽量使其为自己工作。郁只需要修改 setAnimationTransition
It is possible, look at the following code I used a while back and try to make it work for yourself. Yu only need to change the setAnimationTransition
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDelay:0.375];
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];
有几个不同类型的默认动画使用,苹果网站说,这种动画是可能的:
There are a few different kind of default animations to use, apples site says this kind of animations are possible:
typedef enum {
UIViewAnimationTransitionNone,
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;
所以你的情况,你可能需要使用以下内容:
So in your case you would want to use the following:
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.75];
[self.navigationController popViewControllerAnimated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
这篇关于UINavigationController的:向相反的方向弹出视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!