0

So, in my rotation handler, I am doing some layout for the landscape mode. I wanted to perform some additional animation after the rotation completed, so I increased the duration to a larger value and started a keyframe type animation.

What I find is that for some reason I can't effectively increase the duration. The code below seems to run in the timespan of the rotation (0.4 seconds or whatever) no matter what I set duration to.

Is there something about a rotation animation already being in progress that prevents a longer animation from being started?

Thanks for any help.

  - (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 */ }];

}

Chris
  • 629
  • 1
  • 10
  • 28

1 Answers1

0

Do additional animation in your completion block.

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

gabbler
  • 13,626
  • 4
  • 32
  • 44
  • Thank you. Actually I had tried that, and that does work fine, but I'm wondering why the longer keyframing (above) does not? I feel like I might learn something from that answer. Besides, I might want to start a complex animation before the rotation animation is done (eg from a start at 90% keyframe). Any thoughts? – Chris Sep 12 '14 at 03:42