2012-01-25 27 views
1

我想在我的應用程序中對一系列UIImageView執行一個簡單的動畫。我有我想淡入圖像的網格,使前一個完成後,像這樣下一個圖像開始其動畫我可以把它:交錯的iOS動畫

|--------animation1--------| 

          |--------animation2--------| 

                 |--------animation3--------| 

我與代碼完成這樣的:

- (void)loadOtherIcon; 
{ 
    UIImageView *icon = [icons objectAtIndex:iconCount]; 
    [UIView animateWithDuration:0.5 delay:0.0 options:nil animations:^{ 
     icon.alpha = 1; 
    } completion:^(BOOL finished){ 
     if (iconCount < icons.count - 1) { 
      [self loadOtherIcon]; 
     } 
    }]; 
} 

但我希望他們錯開,這樣的:

|--------animation1--------| 

      |--------animation2--------| 

        |--------animation3--------| 

有什麼建議?

+0

我不會使用UIView動畫的塊表示法。這會'凍結'主線程,所以任何交互都是不可能的。 – basvk

+4

@basvk:這就是'UIViewAnimationOptionAllowUserInteraction'用於 –

+0

@NoahWitherspoon:大聲笑,不知道,謝謝。 – basvk

回答

6

同時啓動每個動畫,但使用增加的「延遲」量。目前,您將其設置爲0.0。