Animate Background Color Of UIButton von WhiteColor zu RedColor

Ich versuche, eine Art Farbimpulseffekt zu erzeugen, der die Hintergrundfarbe eines @ animierUIButton, um die Farbe (WeißFarbe) fortlaufend zu ändern (RotFarbe). Ich versuche, @ zu verwendCABasicAnimation für das Ändern der Deckkraft, aber ich kann es nicht auch mit Farbe arbeiten lassen.

    CABasicAnimation *theAnimation;

    theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
    theAnimation.duration=1.0;
    theAnimation.repeatCount=HUGE_VALF;
    theAnimation.autoreverses=YES;
    theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
    theAnimation.toValue=[NSNumber numberWithFloat:0.0];
    [BigButton.layer addAnimation:theAnimation forKey:@"animateOpacity"];

Jeder Vorschlag wäre dankbar. Vielen Dan

Antworten auf die Frage(6)

Ihre Antwort auf die Frage