Infinitely looping animation

I am trying to create an endlessly looping animation, but I have problems. I use this line of code to make my look "pulsating" red, but when I call this line, it works, but my user interface does not respond.

[UIView animateWithDuration:1.0f delay:0.0f options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat) animations:^{ self.backgroundColor = [UIColor colorWithRed:0.5 green:0.0 blue:0.0 alpha:1.0]; } completion:nil]; 

My questions are: 1) is this the right way to do this? 2) why does this make the user interface unresponsive?

+7
source share
1 answer

Your parameters should include UIViewAnimationOptionAllowUserInteraction . By default, a UIView animation disables input at run time.

+10
source

All Articles