ios - 如何在 View 中的ios中制作翻转动画

标签 ios uiviewanimation flip

我在主视图中添加了 4 个 UIView 类型的 subview 。我想用平滑的翻转动画翻转这些 View 。我已经尝试过但无法成功完成它。这是我使用的代码。

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:signUpView cache:YES];
[UIView commitAnimations];


它翻转一半并立即显示另一个 View 。
让我知道怎么做?

最佳答案

在开始时,我将我的 firstView 添加到 containerView

[self.containerView addSubview:firstView];

在那之后你需要添加你的翻转过渡
[UIView transitionWithView:self.containerView
                  duration:1
                   options:UIViewAnimationOptionTransitionFlipFromRight
                animations:^{ [firstView removeFromSuperview]; [self.containerView addSubview:secondView]; }
                completion:NULL];

关于ios - 如何在 View 中的ios中制作翻转动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16911236/

相关文章:

swift - CGAffineTransform 弄乱了 ViewFrame

c - 如何在C中从上到下写入文件

jquery - 翻转模态 jquery 对话框禁用我的 Javascript

iphone - 付费到免费反射(reflection)时间Appstore

ios - 检测自定义键盘扩展中的输入对象 View 类型

ios - 使用来自不同函数的 tableviewcell

c# - 如何将参数传递给 NSAction?

iphone - 如何创建流畅的图像动画

ios - 尝试在 Swift 中使用 AutoLayout curl / curl 两个 View

ios - 多个翻转动画不起作用