Question

Has anyone written iPhone classes that mimic the behavior of the Application Settings? It would be nice to be able to define settings tables for use within my app using exactly the same XML structure, etc.

Was it helpful?

Solution

See Is there a library or framework for setting preferences from within an iPhone application?

Esp. the mySettings library mentioned there:

mySettings [...] uses a plist configuration file like the one used by the settings app, with some added options.

[...]

By default the settings themselves are stored in the standard user defaults object ([NSUserDefaults standardUserDefaults]), but you can use any object that supports key-value coding. This enables you to use your model classes directly in the settings view.

OTHER TIPS

The application settings (or NSUserDefaults) is essentially a glorified NSDictionary. You add objects to the settings and associate them with keys, so you can retrieve them later on.

If you want to do this, just create a class which wraps a singleton instance of a NSDictionary. That way you could reference it throughout your app like:

[[MyAppSettings sharedInstance] objectForKey:key];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top