I try to make a button invisible after pressing it. The Connection is an action and not an outlet, because pressing the button will call additional code.
@IBAction func startGame(_ sender: Any) {
print("The game starts...")
}
This does not work, because the button is an action and not an outlet:
startGame.isHidden = true
Is there another way to make an action button invisible and therefore not clickable?
Just create an IBOutlet
of the same button and set its isHidden
property to true
once it's tapped.
@IBAction func startGame(_ sender: Any) {
startGameButton.isHidden = true
}