Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode : Storyboard and retaining data in each controller

As you can guess i am a new programmer and i have trouble getting a simple thing! I am making an app with multiple view controllers. Each controller have textfields and UIsegmentedControl items. When i am moving from one view controller to the other (uding modal trantition if that matters), the contents of the previous one (textfield entries and segmented control option) reset to their original state. How can i make them keep their previous state? Thanks in advance.

like image 274
Pantelis Proios Avatar asked Nov 04 '22 07:11

Pantelis Proios


1 Answers

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    bViewController *deneme = [segue destinationViewController];
    [deneme setPassedValue:label.text];
}

This piece of code will solve your problem, I hope. It saves the label of whatever is inside of it. And you need to add some more code to other classes.

If this code helps you tell me and I can give you the whole code.

like image 58
user1199409 Avatar answered Nov 10 '22 20:11

user1199409