I will prepare a rating on my Xcode project; so I need the following;
I have 5 rating buttons, from worse to very good, and each has its own if statement as below;
@IBAction func btnHeart1Pressed(_ sender: UIButton) {
if sender.isSelected {
sender.isSelected = false
}else {
sender.isSelected = true
}
}
But;
by clicking on the e.g. third button, first, second and third button shall be selected or by selecting the fifth button, all 5 buttons shall be selected.
Aucun commentaire:
Enregistrer un commentaire