skip to Main Content

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

2

Answers


  1. 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 
    }
    
    Login or Signup to reply.
  2. @Doug Null To connect the @IBOutlet. First, follow what @AngrayDuck said. After that do as following:

    1. Go to the storyboard.
    2. Open "Connection inspector" on the right side. Can open through shortcut "Command + Option + 7".
    3. Follow the steps highlighted in the below image.

    enter image description here

    Hope this helps.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search