iPad: Animate UILabels color changing

后端 未结 7 407
礼貌的吻别
礼貌的吻别 2020-12-04 20:37

I have a label which pops up displaying points in my application. I am using the following code to make the label get larger in scale, then smaller. I would also like to ani

7条回答
  •  感动是毒
    2020-12-04 20:45

    This line of code works for me. Make sure to set the Options to Cross Dissolve Swift:

    static func animationButtonTextColor(button : UIButton, toColor : UIColor, duration : NSTimeInterval) {
        UIView.transitionWithView(button, duration: duration, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {
          button.setTitleColor(toColor, forState: .Normal)
        }, completion: nil)
      }
    

提交回复
热议问题