¿Cómo cambiar el color del botón2 rápidamente cuando se hace clic en el botón1?
Todo lo que quiero hacer es cambiar elbackgroundColor
de fiveMinButton y tenMinButton cuando se hace clic en fiveMinButton. ¿Por qué no funciona este código?@IBAction
tampoco 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
}
}