好吧我现在已经解决了这个问题一段时间了,而且这远远超出了我的专业知识,因此我再次寻求帮助。
我正在尝试设置tabbarbutton单击转换到另一个视图的过渡动画。我在viewController(ViewWillAppear)方法中声明了下面的代码
- (void)viewWillAppear:(BOOL)animated
{
//TODO: Fix transition animation
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
forView:self.view cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView commitAnimations];
[super viewWillAppear:animated];
}
右边的FirstViewController和左边的SecondViewController。
现在问题发生在用户第一次加载应用时,一旦所有内容加载并且用户点击tabbarbutton转到第二个视图,它就不会翻转..但是当你回到FirstView它动画然后,如果你再次进入第二个它将动画这一轮。剂量任何人都知道为什么会发生这种情况?如果你的帮助将不胜感激!
UPDATE :: 我正在尝试将一个动画添加到viewDidLoad中,但是我已经有一个动画用于我正在立即加载的开场序列。
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//-- Start Opening Animation ------->
CGRect vaultTopFrame = vaultTop.frame;
vaultTopFrame.origin.y = -vaultTopFrame.size.height;
CGRect vaultBottomFrame = vaultBottom.frame;
vaultBottomFrame.origin.y = self.view.bounds.size.height;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2.5];
[UIView setAnimationDelay:2.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
vaultTop.frame = vaultTopFrame;
vaultBottom.frame = vaultBottomFrame;
[self.view bringSubviewToFront:vaultTop]; //this should place this subview above any others on the same page
[self.view bringSubviewToFront:vaultBottom]; //this should place this subview above any others on the same page
[UIView commitAnimations];
我认为这可能会让我感到烦恼,你觉得怎么样?
答案 0 :(得分:0)
应用加载时您没有动画。在视图加载时在viewDidLoad
中为动画设置动画,当用户在病房之后进行转换时viewDidAppear
将为您提供动画(每次单击选项卡时)。
答案 1 :(得分:0)
这可能是也可能不是问题,但你应该致电
[super viewWillAppear:animated];
在方法的开头,在动画代码之前。