[英]Animating a UIImageView with delay
我正在以这种方式对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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.