我正在尝试一个接一个地执行多个 UIView 动画。但是,我听说一个接一个地执行多个 UIView 动画是不好的做法,我应该改用 Core Animation。我试过这段代码:
//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 两个动画共存,但它的上下文略有不同。