Domanda

Come posso fare il colore di un battito di ciglia UITextField sfondo?

È stato utile?

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
scroll top