Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a quick question. I have a ViewController (parent) that has a UITableView in it. Within that view contains a button triggering a modal segue to another viewController (child) with a UITableView. The child viewController acts as a filter to update the parent's table. My goal is to preserve the state of the filter viewController (child) after dismissal, so I can go back and update the filter selection.

After researching, I have found the docs contain information on preserving the state of the application as a whole, in situations where the app closes, etc. I am unsure if this is the sort of approach I need in order to preserve this viewController after dismissal.

Links are here:

Apple Docs

Blog Walkthrough

Is this the proper way of approaching this or do I have it all wrong?

Thanks!

share|improve this question

1 Answer

Check NSUserDefaults Document

Example:-

For retrive state:

 NSString *value=[[NSUserDefaults standardUserDefaults] valueForKey:@"Type"];

Save state:-

[[NSUserDefaults standardUserDefaults]setValue:@"FilterType" forKey:@"Type"];
[[NSUserDefaults standardUserDefaults]synchronize];
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.