Repeating animations using the Stop Selector

Posted by Tiago on Stack Overflow See other posts from Stack Overflow or by Tiago
Published on 2010-05-26T04:38:59Z Indexed on 2010/05/26 4:41 UTC
Read the original article Hit count: 210

Filed under:
|
|

I'm trying to repeat an animation until a certain condition is met. Something like this:

- (void) animateUpdate {
    if (inUpdate) {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:2.0];
        [UIView setAnimationDelegate: self];
        [UIView setAnimationDidStopSelector: @selector(animateUpdate)];
        button.transform = CGAffineTransformMakeRotation( M_PI );
        [UIView commitAnimations];
    }
}

This will run the first time, but it won't repeat. The selector will just be called until the application crashes.

How should I do this?

Thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about animation