lundi 25 septembre 2017

Custom checkbox in swift 3

am new to swift,

I had two check box buttons on view controller, when click single check box button(Indvidual) it's check and uncheck working fine, but my aim is when I check "PICK" checkBox button uncheck the "Drop Check Box"

image

if select pick check Box ==> uncheck "Drop" checkBox

if select the Drop CheckBox - unchecked the Pick

this is my code for single check

@IBAction func PushButtonClick(_ sender: UIButton) {

        let buttontag = sender.tag


        if isChecked {
            sender.setImage(UIImage(named:"check1"), for: .normal)
            print("checked")


            isChecked = false
        }
        else {
            sender.setImage( UIImage(named:"uncheck1"), for: .normal)
            isChecked = true
            print("uncheck")

        }
    }

    @IBAction func DropButtonClick(_ sender: UIButton) {


        if isChecked {
            sender.setImage(UIImage(named:"check1"), for: .normal)
            print("checked")
            isChecked = false
        }
        else {
            sender.setImage( UIImage(named:"uncheck1"), for: .normal)
            isChecked = true
            print("uncheck")

        }

    }

if one check box check check other check box Is unchecked how to over come this problem........




Aucun commentaire:

Enregistrer un commentaire