Reputation: 2488
I have a storyboard with three scenes, all of which contain the same UILabel
. It is connected to an IBOutlet, IBOutlet UILabel *mainLabel;
in my ViewController.h
and everything works until the scene is changed, when it resets as if the app was killed from the background and launched again.
The UILabel should simply not reset when the scene is changed and keep the value it had prior to the change instead of resetting to the default value.
The changes between scenes are done solely through the Storyboard as modal segues.
I would provide more relevant code but I can't find anything that could affect this.
How would You fix this?
Upvotes: 0
Views: 99
Reputation: 1303
is the viewDidUnload called? in case of memory needs a view not on screen can be unloaded, in that case it gets loaded again from the nib the next time it is needed, restoring to default values. the viewController is not, so you can store the label content in an ivar (NSString?) and on viewDidLoad you can restore then the state of your label.
Upvotes: 1