Fare UITextField sfondo lampeggio
-
09-09-2019 - |
Domanda
Come posso fare il colore di un battito di ciglia UITextField sfondo?
Soluzione
creare una funzione che alterna il colore di sfondo.
-(void) flashBackground
{
UIColor* color = _flashOn ? [UIColor colorRed] : [UIColor colorWhite];
_textField.backgroundColor = color;
[_textField setNeedsDisplay];
_flashOn = !_flashOn;
}
Quindi impostare un timer per chiamare questa funzione
[NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(flashBackground) userInfo: nil repeats: NO];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow