uilabel - After switching Views, I want my label text to remain what it was before switching -


i close this. , apologize being new @ coding. question not hardest thing figure out. here things should know beforehand:

right have simple tally app irl board game i'm making.

the tally app not on main view of app. so, tally app, click button.

on tally app theres , down button +1 , -1.

there's uilabel shows result. when press button 3 times, label on app says "3".

but when go main view, , go tally app, number still there, shows "0". when press button, says "4". not "1". knows state of label, doesn't show state of label. shows 0 when go , forth between views.

how can make show state of label when switching views , coming back?

here viewdidload code

- (void)viewdidload {     count.text = [nsstring stringwithformat:@"%i", number];    } 

put same code in "viewdidappear" well. viewdidload called once when view created, not every time appears.

in viewdidload, make sure call [super viewdidload]; in beginning. similar in viewdidappear.


Comments