I have a UIView with a number of subviews and a Tap gesture recognized associated and I want to mimic it having a 'touch' effect. That is, when the tap happens, I want to show the container view to have a different background color and the text of any subview UILabels to also look highlighted.
When I receive the tap event from UITapGestureRecognizer, I can change the background color just fine and even set the UILabel to [label setHighlighted:YES];
For various reasons, I cannot change the UIView to UIControl.
But if I add some UIViewAnimation to revert the highlighting, nothing happens. Any suggestions?
- (void)handleTapGesture:(UITapGestureRecognizer *)tapGesture {
[label setHighlighted:YES]; // change the label highlight property
[UIView animateWithDuration:0.20
delay:0.0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
[containerView setBackgroundColor:originalBgColor];
[label setHighlighted:NO]; // Problem: don't see the highlight reverted
} completion:^(BOOL finished) {
// nothing to handle here
}];
}
UIButton
? – Peter Kazazes