我試圖一個接一個地執行多個UIView動畫。但是,我聽說一個接一個地執行多個UIView動畫是不好的做法,而我應該使用Core Animation。我試過這個代碼:多個UIView動畫
//First Animation
[UIView beginAnimations:@"animation1" context:nil];
[UIView setAnimationDuration:2];
nwView.backgroundColor = [UIColor redColor];
nwView.frame = CGRectMake(CGRectGetMidX(screenSize),
CGRectGetMinY(screenSize),
width,
height);
nwView.transform = CGAffineTransformMakeRotation(45.0f);
[UIView commitAnimations];
//Second Animation
[UIView beginAnimations:@"second animation" context:nil];
[UIView setAnimationDuration:2];
nwView.transform = CGAffineTransformMakeScale(0.5, 0.33);
nwView.backgroundColor = [UIColor purpleColor];
[UIView commitAnimations];
但它只做第二個動畫。我知道這個問題類似於UIView two animations coexisting,但它有一個稍微不同的上下文。
完全不正確的。如果被中斷,例如用戶離開應用等,塊基動畫的完成塊將不會被調用。 – durazno