I have a gridView, I use to display several GridViewCell : UIView
. The GidViewCell
adds an UILabel to itself and attaches anUITapGestureRecognizer
to itself.
UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)];
[self addGestureRecognizer:gestureRecognizer];
[gestureRecognizer release];
in tapped:
I want to play some animation, including changing the background color of the label
- (void) tapped:(id)sender {
[UIView animateWithDuration:1.0
delay:0
options:(UIViewAnimationOptionAllowUserInteraction)
animations:^{
[(UILabel *)[[self subviews] objectAtIndex:0] setBackgroundColor:[UIColor blueColor]];
}
completion:^(BOOL finished){
[(UILabel *)[[self subviews] objectAtIndex:0] setBackgroundColor:[UIColor whiteColor]];
}
];
[self.delegate didSelectGridViewCell:self];
}
But the label just flashes blue for a blink of an eye — if at all. If I use the same code but adjust the alpha of the label instead of the background color, everything works as expected.
Apple's docs lists backgroundColor as animatable. Is it? Am I doing something wrong?