Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
- Subject: Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
- From: Rick Hoge <email@hidden>
- Date: Wed, 7 Jan 2009 08:28:58 -0500
I pulled my hair out over this one, but I finally found an
acceptable workaround, although it doesn't solve the fundamental
problem of NSDictionaryController.
Thanks very much for the reply and workaround. I will explore this
solution further.
The NSDictionaryController/bindings route seems to work fine if you
have a simple mutable dictionary in which the keys are strings and
the values are discrete objects like NSStrings or NSNumbers. Then
you can edit the values with no problem. It just seems to get
difficult when the dictionary values are themselves collections. I
could live with this I suppose, in cases where read-only display of
the dictionary was the primary goal. However it would really be
nice to be able to edit the contents of collections, and the present
limitations should really be mentioned in the documentation (maybe
the current docs say so in some obtuse way, but if so I didn't catch
it).
After considering this problem some more, it seems like in my case the
easiest workaround is to abandon the idea of having a dictionary of
dictionaries and instead use an NSArray (or NSSet) of dictionaries.
This will avoid the use of mysterious immutable proxy dictionaries by
NSDictionaryController and should deliver equivalent functionality.
Originally I was attracted by the simplicity of obtaining a list of
entries using allKeys, and addressing the entries by name, but similar
functionality could be obtained with other connection objects using
predicates (with a bit more complexity).
Would still be sweet if NSDictionaryController provided deeper read-
write access to embedded dictionaries, but I won't hold my breath.
Thanks again,
Rick
_______________________________________________
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