2

我注意到,如果我在控制器“A”的某个元素上启动 UIView 动画并呈现带有过渡的控制器 B,则之前提交的动画不会启动。例如:

//apply a UIView animation before transitioning
[UIView animateWithDuration: 1 delay:0 options:UIViewAnimationOptionCurveEaseOut             animations:^{
        someUIView.frame = newFrame;
 }completion:nil];
//transition from  controller A to controller B
controllerB.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController: controllerB animated:YES];

如果动画已经开始并且我尝试转换到控制器 B,则 A 中的动画将停止。我注意到这种行为取决于使用的转换类型。例如,如果使用“UIModalTransitionStyleCoverVertical”,则不会出现问题。有什么想法吗?

4

1 回答 1

0

只需从动画完成块中展示您的控制器B

[UIView animateWithDuration: 1 
                      delay:0
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{
                     someUIView.frame = newFrame;
                }completion:^{
                   //transition from  controller A to controller B
                   controllerB.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
                   [self presentModalViewController: controllerB animated:YES];
 }];
于 2012-08-05T14:51:27.680 回答