2011-03-25 55 views
2

请我已经在做,从一个视图到另一个去时,翻转动画的问题,我解释一下: 我发现在这个网址教程:http://www.youtube.com/watch?v=Rgnt3auoNw0 这说明我该怎么办在这个教程中添加视图但是方法和矿井wasn`t一样,虽然我试图把他在我的IBAction为使用的代码,所以我的IBAction为看起来像这样:从视图导航,查看时进行翻转动画

-(IBAction)goToRechercherView{ 
[UIView beginAnimations:@"flipview" context:nil]; 
[UIView setAnimationDuration:2]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 
         forView:self.view cache:YES]; 
[self presentModalViewController:rechercherViewController animated:YES]; 
[UIView commitAnimations]; 
} 

喜欢我的应用程序的构建成功,但没有过渡,当我从我的视野导航,我已经puted的iBAction,请帮助,thx提前:)

+0

它看起来并不像你展示它之前创建rechercherViewController。 – adamweeks 2011-03-25 14:27:25

+0

嗨,实际上我没有创建它作为一个类,除了在我的主视图的.h我已经导入它:#import“RechercherViewController.h”,我已经instancied它:IBOutlet RechercherViewController * rechercherViewController – Malloc 2011-03-25 14:31:07

回答

7

您不应该需要任何动画代码。只需将presentModalViewController之前:

rechercherViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
+0

谢谢sooo多:) – Malloc 2011-03-25 14:56:40

+0

如何在这种情况下管理动画持续时间? – Malloc 2011-03-25 15:07:47

+0

如果您想自定义过渡时间,您应该查看@ Dancreek的答案。设置.modalTransitionStyle会给你苹果的风格。 – adamweeks 2011-03-25 15:26:38

2

一件事,这将有助于就是改变动画:以不上presentModalViewController:行。我昨天遇到了类似的情况。您基本上要求操作系统为已被要求进行动画处理的内容制作动画。这应该有所帮助。

1

这为我工作

 
Yourviewcontroller *obj = [[Yourviewcontroller alloc]init]; 

    obj.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    [self presentModalViewController:obj animated:YES];