LoginSignup
30

More than 5 years have passed since last update.

UILabel の textColor をアニメーションさせる

Posted at

UILabel とかのテキストの色 textColor をアニメーションでふわっと代えたい場合、transitionWithView:duration:options:animations: を使うのが簡単。

[UIView transitionWithView:self.myLabel
                  duration:0.5
                   options:UIViewAnimationOptionTransitionCrossDissolve
                animations:^{
                    self.myLabel.textColor = [UIColor whiteColor];
                } completion:^(BOOL finished) {
                }];

すごい今更感あるTipsですが、ググると

こういうのが出てきて、上記のシンプルな方法がすぐに見つからなかったので備忘録として。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30