I am doing a very simple repeating animation to fade a label in and out, seen below. I assumed the completion block would be called every time the animation finishes, but when using UIViewAnimationOptionRepeat
it is never called. So how am I supposed to stop this animation?
I know I can use [self.lbl.layer removeAllAnimations];
, however that ends its very abruptly. I want to know when it has finished a cycle of the animation so I can stop it at that time.
[UIView animateWithDuration:1.0 delay:0 options:UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveEaseInOut animations:^{
self.lbl.alpha = 0;
} completion:^(BOOL finished){
if (finished) NSLog(@"done");
}];