Aprove answer

Without seeing your code, this is a little hard to determine, but I would suggest the following:

  1. Be sure you have connected the buttons to an Outlet variable. This is critical. Without connecting them, you can use the hidden boolean, but it would not have an effect on an actual button.

  2. Be sure you are not somehow undoing your own changes. For example, further down in the code, you might have something which is setting hidden to false even after you set it to true, and so on.

  3. In some cases, you might want to set your outlet variable as strong instead of weak. This may retain changes that are being lost with a view switch.

  4. You can also use "alpha" such as:

    myButton.alpha = 0

as an alternate way of controlling visibility. 0 would set the alpha to none (which would make the button invisible) and 1 would set the alpha to full (which would make the button visible again.)

  1. Right after you set hidden (or alpha) put in: println("i hid the button!") just to be sure the code you think you are executing really is being executed. Sometimes code we think is not working is actually not even being called.

Please provide more info and I will gladly work to get this solved for you.

Credit Goes to: stackoverflow.com

Related question with same questions but different answers