Frage

I'm using an Utility Application.

On the flip side I have a slider which I want to use for setting the (in-app) User Preference.

Say the user sets the value of the slider to 40 in the flip window, then click "Done" and return to the main window. The main window will use this value of 40. Also, the value has to stay persistent even after the application is closed / open or the device (iphone, ipad) is switched off / on.

Can you please example or point me to documentation on how do I do that? Is this done with Settings.bundle? Many thanks!

War es hilfreich?

Lösung

Store and retrieve your values using NSUserDefaults.

CGFloat value = [[NSUserDefaults standardUserDefaults] floatForKey:@"valueKey"];

To read, and to write:

[[NSUserDefaults standardUserDefaults] setFloat:value forKey:@"valueKey"];
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top