How to make a swift so that when you press the digging button it disappears, I use 2 swift, do not judge strictly, I'm new.

    3 answers 3

    You can also just play around with alpha.

    @IBOutlet weak var myButton: UIButton! @IBAction func myButtonPressed(_ sender: Any) { myButton.alpha = 0 ... } 
    • YOUR COUNCIL IS THE BEST FOR 2 SWIFT - The Life Of The Poor

    Swift 3

      @IBOutlet weak var myButton: UIButton! @IBAction func myButtonPressed(_ sender: Any) { myButton.isHidden = true } 

    Swift 2

     @IBOutlet weak var myButton: UIButton! @IBAction func myButtonPressed(_ sender: Any) { myButton.hidden = true } 
       @IBOutlet weak var myButton: UIButton! @IBAction func myButtonPressed(_ sender: Any) { myButton.removeFromSuperview() ... } 
      • Why remove? Can there be a Visible property or something? Maybe you need a link to the source, or at least a brief comment on the code. - nick_n_a