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?
I fixed using the following piece of code:
And calling it in the ViewController.
Btw. Thanks a lot Malloc!