gpt4 book ai didi

ios - uiswitch 状态改变问题

转载 作者:行者123 更新时间:2023-11-28 14:24:44 24 4
gpt4 key购买 nike

我有一个开关,我想根据某些条件限制切换。我们如何根据某些条件限制开关状态的变化?我还在 DispatchQueue.main.async 中尝试了 setOn。

if sender.isOn{
self.pmLabel.textColor = UIColor.ktvPurple()
self.amLabel.textColor = UIColor.lightGray

if let pmTime = self.eveningShowtime{
updateClock(from: CGFloat(pmTime), to: CGFloat(pmTime) + CGFloat(durationsHours))
updatePieChart()
}else{
self.view.makeToast("Evening Shows are not available", duration: 1.0, position:CGPoint(x: SCREENWIDTH/2, y: SCREENHEIGHT - 180))
ampmSwitch.isOn = false
}

}else{
self.amLabel.textColor = UIColor.ktvPurple()
self.pmLabel.textColor = UIColor.lightGray
if let morningTime = self.morningShowTime{
updateClock(from: CGFloat(morningTime), to: CGFloat(morningTime) + CGFloat(durationsHours))
updatePieChart()
}else{
self.view.makeToast("Morning Shows are not available", duration: 1.0, position:CGPoint(x: SCREENWIDTH/2, y: SCREENHEIGHT - 180))
ampmSwitch.isOn = true

}




}

最佳答案

例如:

if yourCondition {
yourSwitch.enabled = false
}

关于ios - uiswitch 状态改变问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51704500/

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