I have the following code to animate a badge if a certain condition is met. It works fine, except when it is called immediately after the ViewController is re-loaded after a look-up (in another VC)
if ((-MY CONDITION HERE-) {
NSLog(@"am going to animate!");
[UIView animateWithDuration:1.0
delay:0
options:(UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat)
animations:^{
selectedInfoButton.alpha = 0.4;
}
completion:nil];
}
I can see that the method is called when the VC is re-loaded, but the animation is ‘frozen’ in the same state as when the look-up is called. What could be going wrong?
Possibility:
One time works in
viewControllerthe code is called in
viewDidLoadmethod .Then add it in
viewWillAppearCheck the condition is satisfied,(that is the code hits in the block ) the second time the ViewController reappers