I have an array of around 20 UIButtons which I would like to control the selection and unselection of a set of criteria.
I have used the following as a basis https://iostutorialjunction.com/2018/01/create-checkbox-in-swift-ios-sdk-tutorial-for-beginners.html
In the example below, I have a button called mondayAM, and one called mondayPM. For the life of me, I cannot figure out how to deselect the mondayPM button. When I try and use mondayPM.isSelected, it doesn't work
@IBAction func mondayAM(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
}
@IBAction func mondayPM(_ sender: UIButton) {
}
Can anyone help me figure out what I need to do to be able to deselect one or more other buttons so that I can better simulate radio buttons, please?
Aucun commentaire:
Enregistrer un commentaire