ios - How to change values of variables when navigating from one view controller to another? -
in project have main page,with 4 buttons. first 3 define game level user wants play:
button 1-level 1 button 2-level 2 button 3-level 3
button 4 - start game
when 1 of them clicked int value saved in order know level user wants play.
when clicking forth button depending on int value given user goes appropriate game level page. when gets page can hit button anytime go main view controller. issue when goes back,how return button's values default value? (that no button/level chosen).
you can use viewwillappear
method reset button states default. viewwillappear
method called every time when viewcontroller going visible, best place house keeping stuff.
Comments
Post a Comment