Answer the question
In order to leave comments, you need to log in
How to implement only one selected checkbox?
Hello.
There are 7 buttons in the form of a checkbox, I want to make it possible to select only one. For example, if one is selected and you click on another, then the one that is selected becomes not selected, but the one that is clicked is selected. In my head, the current is a sea of \u200b\u200bif ((but I wanted to get by with a little bloodshed
Or maybe I can implement it somehow through the table, I’ll never know!
I’ll thank you for any help!
Answer the question
In order to leave comments, you need to log in
There are 7 buttons in the form of a checkbox, I want to make it possible to select only one.It's called RADIOBUTTON .
put all the buttons in an array, in the method of pressing the buttons you insert for this array
func actionMethod(_ sender: UIButton) {
buttonsArray.forEach { $.isSelected = $ == sender }
.
.
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question