Tengo una UIView con varias subvistas y un gesto Tap reconocido como asociado y quiero imitarlo teniendo un efecto de 'toque'. Es decir, cuando ocurre el tap, quiero mostrar la vista de contenedor para tener un color de fondo diferente y el texto de cualquier subvista UILabels para que también se vea resaltado.Destacando una UIView similar a UIButton
Cuando recibo el caso del grifo de UITapGestureRecognizer, que puede cambiar el color de fondo muy bien e incluso establecer el UILabel a [label setHighlighted:YES];
Por diversas razones, no puedo cambiar el UIView a uicontrol.
Pero si agrego algo de UIViewAnimation para revertir el resaltado, no ocurre nada. ¿Alguna sugerencia?
- (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
}];
}
¿Por qué no lo convierten en un 'UIButton'? –
Porque no es una base de código que tengo y hay otras dependencias, así que tengo que dejarlo como UIView. –
Eche un vistazo a esta biblioteca: https://github.com/mta452/UIView-TouchHighlighting –