Change the backgroundcolor of UIButton in IBOutletCollection

107 Views Asked by At

I have 16 button. And I want to change background color of button, when button is clicked.

This is my code:

@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  

    }
}

How can I change when clicked the buutton change background color of button

1

There are 1 best solutions below

1
AudioBubble On
@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  
sender.backgroundColor = // your desired color
    }
}