Reputation: 15
The question is pretty much in the title.
But i'm trying to make a settings page, where when you press a switch a button becomes visible on another page when the switch is turned on, and hidden and un-functional when the switch is off.
Is there any way of doing this?
Upvotes: 0
Views: 71
Reputation: 47231
Ok a good approach would be to have some kind of model which reflects the current state of your settings. Don't save state in the view!
When you turn that particular switch set the model accordingly.
Now when your other view becomes visible you just read your model and set the visibility depending on what's in the model. To know when a view will appear use a UIViewController's viewWillAppear.method
Upvotes: 1