使用Swift 3,如何使UILabel文本具有发光/增长动画?

时间:2017-04-12 02:24:09

标签: animation swift3 uilabel

如何使标签文本执行此操作(使字体变大,然后变小):

enter image description here

1 个答案:

答案 0 :(得分:1)

试试这个:

    myLabel.font = UIFont.boldSystemFont(ofSize: CGFloat(35))
    // set font size which you want instead of 35
    myLabel.transform = myLabel.transform.scaledBy(x: 0.35, y: 0.35)
    UIView.animate(withDuration: 1.0, animations: {() -> Void in
        self.myLabel.transform = self.myLabel.transform.scaledBy(x: 5, y: 5)
        UIView.animate(withDuration: 1.0, animations: {() -> Void in
            self.myLabel.transform = self.myLabel.transform.scaledBy(x: 0.35, y: 0.35)
        })
    })