我看到了单独的动画之间的相互作用,我真的很感激任何消除这种效果的建议.
基本上:我有一个iPhone应用程序,在根视图上包含一个按钮'a'.点击"a"会使用翻转动画在导航视图控制器堆栈上推送视图.推送视图有一个按钮,可以将视图弹回到根目录.
底层代码:
- (IBAction)pushOneView{
TheAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight
forView:delegate.navigationController.view cache:NO];
[delegate.navigationController
pushViewController:oneViewController animated:NO];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
}
这似乎工作正常,动画非常流畅.
根视图还包括子视图('panelView')和另一个按钮'b'.panelView可以显示另外两个子视图 - 使用旋转动画点击这些子视图之间的"b"交换.代码:
-(IBAction)swapPanels{
UIViewController *coming;
UIViewController *going;
float rotation;
if (self.aPanel.view.superview == nil) {
coming = aPanel;
going = bPanel;
rotation = 3.14;
}
else {
coming = bPanel;
going = aPanel;
rotation = -3.14;
}
// First half of spin
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
CGAffineTransform swirlTransform = …Run Code Online (Sandbox Code Playgroud)