gpt4 book ai didi

ios - 延迟动画UIImageView

转载 作者:行者123 更新时间:2023-12-01 17:58:16 26 4
gpt4 key购买 nike

我正在以这种方式对UIImageView进行动画处理:

int timerAnimation = 0.0f;

for (UIImageView* img in imageArray) {

timerAnimation = timerAnimation + 1.0f;

[UIView animateWithDuration:1.0f
delay:timerAnimation
options:UIViewAnimationOptionCurveEaseIn
animations:^(void) {
img.frame = CGRectMake(20, img.frame.origin.y, 710, 60);
}
completion:NULL];

我想减少延迟时间,但是我注意到,如果将任何值设置为1.0以下,

例如
timerAnimation + 0.5f;

然后所有对象在保存时间移动,好像没有延迟。为什么是这样?

最佳答案

您正在使用int!

int timerAnimation = 0.0f;

应该是浮点数:
CGFloat timerAnimation = 0.0f;

一个int不支持小数,因此您只能在其上加上整数(1.0),而不能加上半数(0.5)

关于ios - 延迟动画UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13847478/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com