gpt4 book ai didi

ios - UIButton不会在每次点击时“闪烁”

转载 作者:行者123 更新时间:2023-12-01 22:10:19 29 4
gpt4 key购买 nike

我在UIButtons中有3个UIView,它们具有相同的文本颜色和相同的背景颜色。轻按三个按钮即可触发相应的事件。但是只有其中之一会响应触摸而“闪烁”。其他两个会发生什么?它们有时(但很少)具有“闪烁”行为,但是touch up inside event总是在点击时触发。

按钮添加在storyboard中:

enter image description here

最佳答案

 func btnFlash_Clicked(sender: AnyObject) {
if !flashing{
callButton.alpha = 1.0
UIView.animate(withDuration: 0.5, delay: 0.0, options: [.allowUserInteraction], animations: {() -> Void in
callButton.alpha = 0.5
}, completion: {(finished: Bool) -> Void in
})

flashing = true
} else{
flashing = false
callButton.alpha = 0.5
UIView.animate(withDuration: 0.5, delay: 0.0, options: [.allowUserInteraction], animations: {() -> Void in
callButton.alpha = 1.0
}, completion: {(finished: Bool) -> Void in
})

关于ios - UIButton不会在每次点击时“闪烁”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54130065/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com