Como mudar a cor do botão2 rapidamente quando o botão1 é clicado?
Tudo o que eu quero fazer é mudar obackgroundColor
de fiveMinButton e tenMinButton quando clicar em fiveMinButton. Por que esse código não funciona?@IBAction
também não vai funcionar.
@IBOutlet weak var fiveMinButton: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
fiveMinButton.addTarget(self, action: Selector(("action:")), for: UIControlEvents.touchUpInside)
func action(sender: UIButton){
if sender === fiveMinButton {
fiveMinButton.backgroundColor = UIColor.gray
tenMinButton.backgroundColor = UIColor.lightgray
}
}