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/

相关文章:

ios - -[__NSCFString _getValue :forType:]: unrecognized selector sent to instance

ios - 为什么 block 在引用 self 时会创建保留循环?

javascript - 如何使用javascript在DIV上创建卡片翻转效果

ios - 导航栏按钮的放置

ios - iCarousel + UITableView = cellForRowAtIndexPath indexPath 始终为空

ios - UIView animatewithDuration - 移除动画

ios - UIView帧动画 "wiggle"

iphone - UIView 动画 block UIView 交互

html - 使用GWT和CSS,如何垂直翻转输入元素中偶数位置的所有字母?

javascript - 如何使 div 跨浏览器一致地翻转?