How can I stop an UIViewAnimationOptionRepeat UIView Animation?

ios, ios7, iphone, uiview, uiviewanimation

Solution

I fixed using the following piece of code:

- (void)restoreAnimations {

    [UIView animateWithDuration:0.1 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear animations:^{
        [element setAlpha: 1.0f];
    } completion:NULL];
}

And calling it in the ViewController.

Btw. Thanks a lot Malloc!

Problem

I have the following code inside of a UIView subclass: ``` [element setAlpha: 0.0f]; [UIView animateWithDuration: 0.4 delay: 0.0 options: UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations: ^{ [element setAlpha: 1.0f]; } completion: ^(BOOL finished){ if (finished) { return; } }]; ``` Then when I want to stop the Animation I send the following message to the View itself: ``` [[self layer] removeAllAnimations]; ``` But it does nothing... How can I stop the animation?

Original source