Re: Array of Preferences
Re: Array of Preferences
- Subject: Re: Array of Preferences
- From: Steven Riggs <email@hidden>
- Date: Wed, 18 Mar 2009 20:52:32 -0400
Hey Frank,
I have a sample project that stores dictionary objects in user
defaults with no code. Check it out: http://idisk.mac.com/steven.riggs-Public?view=web
DictionaryInDefaults.zip
I hope it helps.
Steven Riggs
http://www.stevenriggs.com
On Mar 18, 2009, at 8:14 PM, Frank D. Engel, Jr. wrote:
I have an interesting puzzle on my hands, hoping someone here can
help.
I want to store an array of dictionaries as preferences.
Each dictionary will have two keys; one is a string which will
appear in an NSTableView for identification purposes.
My initial approach here was to create an NSArrayController using
Interface Builder, leave the class name at the default
NSMutableDictionary, and bind the NSTableView column to that
controller, using the key for each dictionary within the array.
The NSArrayController has its Content Array bound to Shared Defaults
using a key I picked for storing in the preferences file.
This all goes fine until I try to rename the dictionary (change that
bound string) within the table view. While the name changes in the
view, if I retrieve the array and append a new object, then set the
preferences back, using code, all of the names revert back to the
originals.
I think what may be happening is that the table view is getting the
dictionary objects from the array controller and updating the keys
of the dictionary, but the dictionary itself never gets synced back
to the preferences?
Any thoughts on an easy way around this?
I did check "Continuously Updates Value" for the column's binding,
but that seems to make no difference.
Thank you for any advice on this!
-----------------------------------------------------------
Frank D. Engel, Jr. <email@hidden>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$
__________________________________________________
D O T E A S Y - "Join the web hosting revolution!"
http://www.doteasy.com
_______________________________________________
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden