setting layered user defaults?
setting layered user defaults?
- Subject: setting layered user defaults?
- From: Mark Dawson <email@hidden>
- Date: Fri, 29 Apr 2005 21:33:46 -0700
I wasn't sure of how to set a user default that is part of layers of
dictionaries:
What I'm not sure how to do is set the "UnitsKey" (which isn't unique)
and is inside the Tool_XXX_DefaultKey (is unique) dict which is inside
the Tool_DefaultKey dict (is unique). What I'm not clear about is
whether the below code is getting a local copy of a dictionary, or
whether the NSUserDefaults database is being updated by my final set.
Am I doing this correctly, or is there a more correct way of doing
things? Thanks!
Do I do the following:
NSUserDefaults *usrD=[NSUserDefaults standardUserDefaults];
][[usrD objectForKey: ToolDefaults] // <<- returns an NSDictionary
object
objectForKey: Tool_XXX_DefaultKey] // <<--returns another
NSDictionary object
setObject: [NSNumber numberWithInt:defaultUnits]
forKey: UnitsKey]] // <<-- now set that object
If I register the following :
NSDictionary *dict= [NSDictionary dictionaryWithObjectsAndKeys:
createToolsDictionaryFromDoc(&ToolDefaults), Tool_DefaultKey,
...,
nil];
Where
createToolsDictionaryFromDoc
does a a return NSDictionary dictionaryWithObjectsAndKeys:
createTools_XXX_DictionaryFromDoc(&ToolDefaults),
Tool_XXX_DefaultKey,
...,
nil];
and
createTools_XXX_DictionaryFromDoc
does a return [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:defaultUnits], UnitsKey,
....
nil];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden