mardi 27 décembre 2016

Checkbox IOS swift


I'am going to work for a project that it will be a lot of checkbox, i found a solution like under but i know this not right why.

 @IBAction func btn_box(sender: UIButton) {
    if (btn_box.selected == true)
    {
        btn_box.setBackgroundImage(UIImage(named: "box"), forState: UIControlState.Normal)

            btn_box.selected = false;
    }
    else
    {
        btn_box.setBackgroundImage(UIImage(named: "checkBox"), forState: UIControlState.Normal)

        btn_box.selected = true;
    }
}

so anyone can suppose to me the best why i have more then 20 checkbox in this projet.

Thanks,




Aucun commentaire:

Enregistrer un commentaire