我在主视图中添加了 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/