Quote:
Originally Posted by Sesa
How can i make, that the settings is in the app itself and not in the settings "app"
|
you must design a view and define costant value that you've create in your plist
Code:
#define kUnit @"unit"
#define kGps @"gps"
and after read your preference in viewDidLoad or similar in this way (simulating a slider and on/off button)
Code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
onoff.on = [defaults boolForKey:kUnit];
sliders.value = [defaults floatForKey:kGps];
and after you must save your data in viewWillDisappear or similar method:
Code:
[super viewWillDisappear:animated];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:onoff.on forKey:kUnit];
[defaults setFloat:gps.value forKey:kGps];
[defaults synchronize];
In the view you need that settings you must read each time viewWillAppear
Code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
onoff.on = [defaults boolForKey:kUnit];
sliders.value = [defaults floatForKey:kGps];
hope helps!
Giorgio