此代码在子类 uiview 的 touchesended 方法中执行,但它没有动画,它只是立即更改背景颜色。怎么了?
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];