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!

有帮助吗?

解决方案

Store and retrieve your values using NSUserDefaults.

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

To read, and to write:

[[NSUserDefaults standardUserDefaults] setFloat:value forKey:@"valueKey"];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top