2012-07-07 34 views
3

我一直在尝试创建简单的“基于块的动画”。我在这里使用一组图像“图像”。然而,当我改变的参数animateWithDuration:delay:我想动画减慢值,但是当我改变这些值20-30无变化甚至发生没有变化发生动画图像的基于块的动画

[UIView animateWithDuration:3.0 
         delay:0.0f 
        options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionCurveLinear 
        animations:^{ imageview.animationImages = images; } 
        completion:nil]; 

:我用这个方法。请帮忙。

回答

1

要更改UIImageView中的图像,您不必将其放入动画块中。您必须使用UIImageViewanimationImagesanimationDuration属性,以及可能的- startAnimating- stopAnimating方法的UIImageView

+0

好吧,我可以尝试,但我要怎么处理延迟?我希望我的动画在延迟1秒后启动。谢谢。 – 2012-07-07 14:31:36

+1

您可以在'-viewWillAppear'方法中使用'[imageView performSelector:@selector(startAnimating)withObject:nil afterDelay:1]'。 – neilvillareal 2012-07-07 14:33:45

0

添加图像阵列

animationImages

的UIImageView

,并给予一定的animationDuration