无法启动基于旋转的动画比旋转持续时间更长?

时间:2014-09-12 02:22:12

标签: ios animation

所以,在我的旋转处理程序中,我正在为横向模式做一些布局。我希望在旋转完成后执行一些额外的动画,因此我将持续时间增加到更大的值并启动关键帧类型动画。

我发现由于某种原因,我无法有效地增加持续时间。无论我将持续时间设置为什么,下面的代码似乎都在旋转的时间跨度内运行(0.4秒或其他)。

旋转动画是否正在进行中,以防止更长的动画被启动?

感谢您的帮助。

  - (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)    toInterfaceOrientation duration:(NSTimeInterval) duration
  {
     duration = 10.0;  // overriding the duration to a longer value

  // running some keyframed animation over the longer animation

       [UIView animateKeyframesWithDuration: duration delay:0.0    options:UIViewKeyframeAnimationOptionBeginFromCurrentState
                              animations:^{

                                  [UIView addKeyframeWithRelativeStartTime:0.0
                                                          relativeDuration:total_duration_sec
                                                                animations:^{ /*do some stuff */ }];

}

1 个答案:

答案 0 :(得分:0)

在完成块中执行其他动画。

[UIView animateKeyframesWithDuration:duration delay:0.0 options:UIViewKeyframeAnimationOptionBeginFromCurrentState animations:^ {} completion:NULL ];

相关问题