2012-07-07 71 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