2013-09-30 45 views
0

我使用animationWithDuration爲動畫元素。我在另一個的completion塊中插入了1個動畫。樓梯的動畫animationWithDuration

[UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 

} completion:^(BOOL finished) { 

    [UIView animateWithDuration:2.0 delay:0.1 options:UIViewAnimationOptionCurveEaseInOut animations:^{ 

} completion:^(BOOL finished) { 
... //and simple 

}]; 
}]; 

所以我有六個樓梯 - animationWithDuration。所以塊的九個元素如何優化呢?

對不起,我的英文。

+0

http://stackoverflow.com/a/7751530/1059705試試這個.. – Bala

+0

難道他們都具有相同的期限,延遲和選項? – Wain

+0

@他們有不同的延遲和持續時間 – user2545330

回答

1

如果您有很多嵌套的動畫,代碼很快就變得無法讀取。 因此,這裏的方法可能是保存所有動畫塊的數組,並在不嵌套它們的情況下遍歷它們。

一個可能的例子這怎麼看起來代碼如下所示: Multiple UIView Animations Without Nested Blocks