-6

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 Answers1

0
@IBOutlet var buttons: [UIButton]!

@IBAction func button_Taped(_ sender: UIButton) {  
sender.backgroundColor = // your desired color
    }
}
  • 1
    Please don't post only code as an answer, but also include an explanation what your code does and how it solves the problem of the question. Answers with an explanation are generally of higher quality, and are more likely to attract upvotes. – Mark Rotteveel Oct 27 '19 at 06:31