I'm animating some subviews, and one of the steps of the animation is to change the view background color. But, despite I have a function that returns a random color, once the background color is set, during the animation definition, it doesn't call my function again to get another color.
Is there some way I can force the animation to call my function every time the animation is executed?
Snippet:
for (UIView* subView in self.view.subviews) {
dispatch_async(dispatch_get_main_queue(), ^{
[UIView animateWithDuration:1.0f
delay:0.0f
options: UIViewAnimationOptionRepeat
animations:^{
subView.backgroundColor = getRandomColor();
}
completion:nil];
});
}