This code is being executed in the touchesended method of a subclassed uiview, however it doesn't animate, it just instantly changes the background color. What is wrong?
self.backgroundColor = [UIColor blackColor];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:20];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
if (score < .40) {
self.backgroundColor = [UIColor redColor];
} else {
self.backgroundColor = [UIColor greenColor];
}
[UIView commitAnimations];