简体   繁体   English

从右到左的Pushviewcontroller动画

[英]Pushviewcontroller animation from right to left

I am creating an interactive iPad App, that is using a lot of Swiping . 我正在创建一个交互式iPad App,该应用程序使用了很多Swiping I want when swiping from right to the left and the animation also should go from right till left is. 我想要从右向左滑动时,动画也应从右向左移动。 the other way from left till right is possible: 从左到右的另一种方式是可能的:

Example swipe left to right, call method : 示例从左向右滑动,调用方法
[self.navigationController pushViewController:viewcontroller animated:YES];
Result: GOOD! 结果:好! Animation from left to right, and that is correct. 动画从左到右,那是正确的。 But now the other way.... 但是现在相反。

Question: How can I animate to go to a other UIViewController from right till left? 问题:如何创建动画从右到左转到另一个UIViewController?

Posible solution?: I tried to use PopViewController but I don't always want to return to the previous ViewController. 可能的解决方案?:我尝试使用PopViewController,但我并不总是希望返回到以前的ViewController。 Is there a way to manipulate the previous ViewController 有没有一种方法可以操纵以前的ViewController

THANKS IN ADVANCE! 提前致谢!

Pass your view which you want to animate in the function below. 在下面的函数中传递您要设置动画的视图。 And it will animate the view from left to right. 它将从左到右为视图设置动画。 Push the view controller 推视图控制器

[self.navigationController pushViewController:viewcontroller animated:NO];

and then pass the viewcontroller's view in the function below 然后在下面的函数中传递viewcontroller的视图

-(void) imgSlideInFromLeft:(UIView *)vew 
{
     CATransition *transition = [CATransition animation];
     transition.duration = 0.4;
     transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
     transition.type = kCATransitionPush;
     transition.subtype =kCATransitionFromLeft;
     transition.delegate = self;
     [vew.layer addAnimation:transition forKey:nil];
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM