按照 Apple 的建议,我通过将后续调用-animationWithDuration:animation:
置于对completion:
的另一个调用块中来链接 UIView 动画aanimateWithDuration:animation:completion:
,如下所示:
[UIView animateWithDuration:scaleDuration delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
// Scale the controllers' views down.
self.view.transform = CGAffineTransformScale(self.view.transform, 0.8, 0.8);
} completion:^(BOOL finished) {
// Transition to the new view and push on the new view controller.
[UIView transitionWithView:self.view duration:1 options:UIViewAnimationOptionCurveLinear | UIViewAnimationOptionTransitionFlipFromLeft animations:^{
[self pushViewController:viewController animated:NO];
} completion:^(BOOL finished) {
[UIView animateWithDuration:scaleDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:
^{
// Scale back to the original size.
self.view.transform = CGAffineTransformScale(self.view.transform, 1.25, 1.25);
} completion:nil];
}];
}];
动画都执行正确的顺序,但它们之间有一个微小的延迟,尤其是在-transitionWithView:duration:options:animations:completion:
调用之前。如何平滑动画步骤之间的过渡?