我几乎可以用 AnimationWithDuration 做 TransistionWithView 能做的所有事情。我真的不确定什么时候只有一个用例超过另一个用例。
在 AnimateWithDuration 上使用 TransitionWithView 的用例是什么?
最佳答案
[UIView transitionWithView:]
允许不限于修改动画属性值的动画操作。例如:
[UIView transitionWithView:containerView
duration:0.2
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{ [fromView removeFromSuperview]; [containerView addSubview:toView]; }
completion:NULL];
这允许您为 subview 的添加、删除、显示或隐藏设置动画,其中 [UIView animateWithDuration:animations:]
仅对可动画属性的值更改设置动画。
关于ios - 与 TransitionWithView 和 AnimationWithDuration 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28098471/