我被一个非常简单的任务难住,我想要一个UIView动画来缓解/缓解,但它总是线性的,尽管使用了正确的animationOption。UIView动画曲线不起作用easenout
这里是所有帐户都应该工作的代码,它被设置在UIViewControllerAnimatedTransitioning类中,但我在以前的自定义segue类中存在相同的问题;
[UIView animateWithDuration:0.4f delay:0.0f options:UIViewAnimationOptionCurveEaseInOut animations:^(void) {
self.dimView.alpha = 1.0;
self.imageView.frame = self.destinationRect;
} completion:^(BOOL finished) {
[self.imageView removeFromSuperview];
[self.dimView removeFromSuperview];
[transitionContext completeTransition:YES];
}];
但是,以下代码的弹簧动画虽然可以工作,但我宁愿不这样做。
[UIView animateWithDuration:0.8f delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:2.0f options:UIViewAnimationOptionCurveEaseInOut animations:^(void) {
self.dimView.alpha = 1.0;
self.imageView.frame = self.destinationRect;
} completion:^(BOOL finished){
[self.imageView removeFromSuperview];
[self.dimView removeFromSuperview];
[transitionContext completeTransition:YES];
}];
我在模拟器和iPad2测试设备上获得了相同的行为。 我做错了什么? 动画框架或alpha值有问题吗?
谢谢ssantos。起初我以为它做到了,但我的眼睛在愚弄我。绝对是线性的。非常奇怪和烦人。 –
确实很奇怪,可能距离太小,不能注意到区别?为了以防万一,我会尝试使用不同“animationCurves”的“大型”动画。 – ssantos