Question

I have a mini-workout application, the root is a UITableViewController and each cell segues to a specific TVC that has its own specific settings denoted by UISliders and UISegmented Controls (As shown by the image).

Of course when I navigate back to the root controller and back again to the specific cell workout, the UIElements forget the previously entered values.

However setting up Entities and Attributes does not seem like the most efficient way to remember the UISettings? Should I use encoder decoder, write to a file?

There must be an efficient way to do this. Thanks.

Too many UI Settings

Was it helpful?

Solution

First create an object call it anything you like, example UIValues.
Let this object have the properties that you want to save:

@property (assign) CGFloat pushupsToday;

....

Create this object and have a strong reference to it. For example in your appDelegate or your RootViewController.

let your viewControllers share this object when you are trying to push new viewController example newViewController.uiValues = self.uiValues.

If you want to save this value to disc, then you have to make to encode and decode values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top