0

In my project I have a main page,with 4 buttons. the first three define which game level the user wants to play:

button 1-level 1 button 2-level 2 button 3-level 3

button 4 - start game

when one of them is clicked an Int value is saved in order to know which level the user wants to play.

when clicking the forth button depending on the Int value given the user goes to the appropriate game level page. when he gets to the page he can hit the back button anytime to go back to the main view controller. My issue is when he goes back,how do I return the button's values to their default value? (that no button/level was chosen).

1 Answers1

0

You can use viewWillAppear method to reset button states to default. viewWillAppear method will get called every time when a viewController is going to be visible, so this is best place to do some house keeping stuff.

Adnan Aftab
  • 14,377
  • 4
  • 45
  • 54