I'd like to have 4 UIViews on the screen and animate their background color when touched and change it back when touches end.
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
[UIView animateWithDuration:0.1
animations:^{
self.backgroundColor = altColor;
}];
}
Unfortunately, when I perform this animation in touchesBegan - touchesEnded won't fire unless the touch ended after the animation completed. This means that touchesEnded gets lost for touches during the animation.
In addition, rapidly hitting the UIView doesn't result in multiple touchesBegan invocations. It seems that no new touches are received until the animation (spawned in the first touch) completes.
How can I respond to all touches with animations? I'd actually like each new touch to interrupt the previous animation ... and start it over again.
Looks like I need to set an option on the block animation