-
Notifications
You must be signed in to change notification settings - Fork 19
4. Read User Defaults
i_82 edited this page Mar 26, 2018
·
1 revision
For each cell property dictionary, if defaults == nil
then (suggested):
NSNumber *enabled = [[NSUserDefaults standardUserDefaults] objectForKey:@"enabled"];
[enabled boolValue];
else if defaults == "myOwnDefaults"
then:
NSString *libraryPath = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES).firstObject;
NSString *uicfgPath = [libraryPath stringByAppendingPathComponent:@"uicfg"];
NSString *myOwnDefaultsPath = [uicfgPath stringByAppendingPathComponent:@"myOwnDefaults"];
NSDictionary *myOwnDefaults = [NSDictionary dictionaryWithContentsOfFile:myOwnDefaultsPath];
NSNumber *enabled = myOwnDefaults[@"enabled"];
[enabled boolValue];
defaults
is a base property defined in Base Cell Properties.