Blinking effect on UILabel

前端 未结 14 1983
野的像风
野的像风 2020-12-13 14:24

I have a UILabel with background color as grey.

I want a blinking effect on this label like it should become a little white & then become gray and it should keep

14条回答
  •  南笙
    南笙 (楼主)
    2020-12-13 14:50

    Got stuck when trying with swift and using multiple options but this seems to work nicely:

    self.cursorLabel.alpha = 1
    UIView.animate(withDuration: 0.7, delay: 0.0, options: [.repeat, .autoreverse, .curveEaseInOut], animations: {
        self.cursorLabel.alpha = 0
    }, completion: nil)
    

提交回复
热议问题