iosswiftibaction

How can i remove the .isSelected when the user pressed other button


Im just beginner in Swift Development. I don't know how to remove the .isSelected when the user choose the other button


Solution

  • maybe this is useful for you :

    if you have several buttons and every one have different action you can follow these level :

    1- in attribue inspector for your button choose a tag for example button 1 tag is 1

    2- in the code action one button and connect it for each Botton

    3- you can access to every button with this one of a code :

      @IBAction func Buttons(_ sender: UIButton) {
        if sender.tag == 1  {
            // do for your button that tag is eaual 1
        }
        if sender.tag == 2 {
            // do for your button that tag is eaual 2
        }
        if sender.tag == 3 {
            // do for your button that tag is eaual 3
        }
        
    }