I\'m trying to have an if statement that will make a button hidden when a label displays a certain status, and appears when the label says something else. The name of the label
The sample code for hiding a button in Swift:
import UIKit
class ViewController: UIViewController {
// Create outlet for both the button
@IBOutlet weak var button1: UIButton!
@IBOutlet weak var button2: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
//Set button2 hidden at start
button2.isHidden = true
}
//Here is the action when you press button1 which is visible
@IBAction func button1(sender: AnyObject) {
//Make button2 Visible
button2.isHidden = false
}
}
And
You have to make the UIButton a property of the class if you want to keep a reference to it. Then you can access it using self.takePhotoButton.