iphone - UIView Animation block not working -


i trying make timer blink red once there less 10 seconds left in game. reason, animation not working. timelabel turns white , stays way. here code i'm using:

if (timeleft <= 9 && timeleft > 0) {     timelabel.textcolor = [uicolor redcolor];      [uiview beginanimations:nil context:nil];     [uiview setanimationduration:1];     [uiview setanimationdelegate:self];     timelabel.textcolor = [uicolor whitecolor];     [uiview commitanimations]; } 

what's weird use exact same code block in app works perfectly. perhaps have animation somewhere in class interfering one?

text color isn't animatable property. can try using catextlayer instead.

another option have identical uilabel red text sitting on top of white uilabel , fade transparent opaque , back. this:

if (timeleft <= 9 && timeleft > 0) {     redtimelabel.alpha = 0;     [uiview animatewithduration:1                       animations:^{                          redtimelabel.alpha = 1;                      }                      completion:^(bool finished){                          redtimelabel.alpha = 0;                      }]; } 

Comments

Popular posts from this blog

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

apache - Add omitted ? to URLs -

php - How can I stop spam on my custom forum/blog? -