How can you change value of animation while it's animating?

Discussion in 'iOS Programming' started by 99miles, Dec 18, 2008.

  1. 99miles
    Expand Collapse
    macrumors member

    Oct 10, 2008
    I'm animating a UIView to a new Y location by changing the frame like this:

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:duration];
    [UIView setAnimationDelegate:self];
    mview.frame = newFrame;
    [UIView commitAnimations];

    Let's say newFrame currently has origin.y = 100. Now, while it's animating I need to change that to 200. Is there anyway to update the current animation or do I have to cancel the first one and start a new animation? I did try that, but there's a noticeable pause where the first animation stop and the new one starts.

Share This Page