问题描述
我有一个带有 UIViewAnimationTransitionFlipFromRight
的iOS UIView。我需要它垂直翻转。页面卷曲过渡不会削减它。我认为这需要一些自定义的东西。
I have an iOS UIView with UIViewAnimationTransitionFlipFromRight
. I need it to flip vertically though. The page curl transition won't cut it. I assume this will require something custom.
任何想法?
推荐答案
从iOS 5.0开始,没有必要编写自己的Core Animation转换来进行垂直翻转。只需使用UIKit的转换,所有这些内容都成为单个方法调用。
As of iOS 5.0, there's no need to write your own Core Animation transformation to do vertical flips. Just use UIKit's UIViewAnimationOptionTransitionFlipFromTop
and UIViewAnimationOptionTransitionFlipFromBottom
transitions, and all this stuff becomes a single method call.
这些行为与 UIViewAnimationOptionTransitionFlipFromLeft
和 UIViewAnimationOptionTransitionFlipFromRight
(从那以后一直存在) iOS 2.0)。
These behave analagously to UIViewAnimationOptionTransitionFlipFromLeft
and UIViewAnimationOptionTransitionFlipFromRight
(which have been around since iOS 2.0).
示例用法:
[UIView transitionFromView:viewToReplace
toView:replacementView
duration:1
options:UIViewAnimationOptionTransitionFlipFromBottom
completion:nil];
以上代码将垂直翻转 viewToReplace $ c $的超级视图C>。在动画的中间点,在超视图垂直于屏幕并因此不可见的瞬间,
viewToReplace
被 replacementView $取代c $ c>。
The above code will vertically flip the superview of viewToReplace
. At the halfway point in the animation, at the instant when the superview is perpendicular to the screen and thus invisible, viewToReplace
gets replaced by replacementView
.
就这么简单。
这篇关于UIView垂直翻转动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!