jeudi 24 septembre 2020

How to implement checkbox in swift?

I am using this code for implementing checkbox but it is not working. Can anyone tell where I went wrong?

@IBAction func tapped(_ sender: UIButton){ if (checkBox.isSelected == false){

            checkBox.setImage(UIImage(named: "selected"), for: .normal)
            checkBox.isSelected = true;


        } else {
            checkBox.setImage(UIImage(named: "unselected"), for: .normal)
            checkBox.isSelected = false;
        }
    }



Aucun commentaire:

Enregistrer un commentaire