在闪烁的按钮页面的同一页面中单击添加按钮以从新页面中选择名称,然后返回到闪烁的按钮页面,闪烁的按钮不闪烁并且呈浅色。
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
})
答案 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
})