在“闪烁”按钮上,它变为浅色阴影

时间:2019-03-30 09:21:50

标签: ios swift button

enter image description here

在闪烁的按钮页面的同一页面中单击添加按钮以从新页面中选择名称,然后返回到闪烁的按钮页面,闪烁的按钮不闪烁并且呈浅色。

    self.checkAvalibilityBtn.alpha = 1.0
    UIView.animate(withDuration: 0.80, delay: 0.0, options: [.curveEaseIn, .repeat, .autoreverse, .allowUserInteraction], animations: {() -> Void in
        self.checkAvalibilityBtn.alpha = 0.2
    }, completion: {(finished: Bool) -> Void in
    })

1 个答案:

答案 0 :(得分:2)

您快完成了。需要在alpha块中将completion重置为1-

    self.checkAvalibilityBtn.alpha = 1.0
    UIView.animate(withDuration: 0.80, delay: 0.0, options: [.curveEaseIn, .repeat, .autoreverse, .allowUserInteraction], animations: {() -> Void in
        self.checkAvalibilityBtn.alpha = 0.2
    }, completion: {(finished: Bool) -> Void in
        self.checkAvalibilityBtn.alpha = 1.0
    })