• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair (From: Rick Hoge <email@hidden>)
 >Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair (From: Simone Manganelli <email@hidden>)
 >Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair (From: Rick Hoge <email@hidden>)

  • Prev by Date: feed an NSCharacterSet to numberOfRowsInSection delegate method?
  • Next by Date: Re: Strange problem of first access to variable
  • Previous by thread: Re: Maintaining mutable values with NSDictionaryControllerKeyValuePair
  • Next by thread: Convert GWorldPtr into a NSImage
  • Index(es):
    • Date
    • Thread