Reputation: 556
I've got application settings working just fine. However, I'd like to be able to change my app settings from within my app.
It seems as though there should be some kind of generic way to add this functionality to my app without having to recreate all the controls myself. I mean, the code is already written in apple's settings app.
Maybe someone wrote this code and open sourced it? (if it is not already available)
Upvotes: 0
Views: 383
Reputation: 282
I prefer my own Settings class as I don't like to write the same stuff again and again. Therefore I am using a method like ...
- (void) setValue:(id)value forKey:(NSString *)aKey {
[[NSUserDefaults standardUserDefaults] setObject:value forKey:aKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
and fetching would be ...
- (id) valueForKey:(NSString *)aKey {
return [[NSUserDefaults standardUserDefaults] valueForKey:aKey];
}
Upvotes: 1
Reputation: 1442
I believe you're looking for NSUserDefaults. The documentation is available here.
Upvotes: 0
Reputation: 85522
A lot of people have thought the same; file a bug with Apple, and maybe eventually they'll listen.
Upvotes: 0