我被一个非常简单的任务困扰,我希望UIView动画能够轻松进入/缓出但是尽管使用了正确的animationOption,它仍然是线性的.
这是所有帐户应该工作的代码,它是在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];
}];
Run Code Online (Sandbox Code Playgroud)
但是,使用以下代码的弹簧动画虽然我不愿意这样做.
[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];
}];
Run Code Online (Sandbox Code Playgroud)
我在模拟器和iPad2测试设备上得到了相同的行为.难道我做错了什么?动画帧或alpha值是否存在问题?
objective-c uiview uiviewanimation ios uiviewanimation-curve