Home > Back-end >  How do I programmatically hide or show the button in a scene's view controller that seques to n
How do I programmatically hide or show the button in a scene's view controller that seques to n

Time:04-22

How do I programmatically hide or show the START SESSION button in a scene's view controller that navigates to the next scene?

enter image description here

CodePudding user response:

create an outlet to your button in the view controller class:

@IBOutlet weak var startButton: UIButton!

and then in whichever function you want you can show hide it, I assume you want it hidden by default So in view did load you can do

override func viewDidLoad()
{
    startButton.isHidden = true
}

and then show it somewhere else

func doSomethingAndShowButton()
{ 
     // Do some other stuff
     ...

     // Show the button
     startButton.isHidden = false 
}

CodePudding user response:

you can add tag in button and then access using tag in your code

  • Related