ios – UIView动画曲线不能正常工作

ios – UIView动画曲线不能正常工作,第1张

概述我被一个非常简单的任务困扰,我希望UIView动画能够轻松进入/缓出但是尽管使用了正确的animationOption,它仍然是线性的. 这是所有帐户应该工作的代码,它是在UIViewControllerAnimatedTransitioning类中设置的,但我在之前的自定义segue类中有相同的问题; [UIView animateWithDuration:0.4f delay:0.0f opt 我被一个非常简单的任务困扰,我希望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];     }];

但是,使用以下代码的d簧动画虽然我不愿意这样做.

[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值是否存在问题?

@H_301_26@解决方法 你可以试试这个.-

[UIVIEw beginAnimations:nil context:NulL];[UIVIEw setAnimationBeginsFromCurrentState:YES];[UIVIEw setAnimationDuration:0.4f];[UIVIEw setAnimationCurve:UIVIEwAnimationCurveEaseInOut];[UIVIEw setAnimationDelegate:self];[UIVIEw setAnimationDIDStopSelector:@selector(animationDIDStop)];self.dimVIEw.Alpha = 1.0;self.imageVIEw.frame = self.destinationRect;[UIVIEw commitAnimations];- (voID) animationDIDStop {    [self.imageVIEw removeFromSupervIEw];    [self.dimVIEw removeFromSupervIEw];    [TransitionContext completeTransition:YES];}

希望能帮助到你.

总结

以上是内存溢出为你收集整理的ios – UIView动画曲线不能正常工作全部内容,希望文章能够帮你解决ios – UIView动画曲线不能正常工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1069028.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存