Re: NSArrayController, custom objects, user defaults
Re: NSArrayController, custom objects, user defaults
- Subject: Re: NSArrayController, custom objects, user defaults
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 5 Feb 2004 14:08:54 -0800
On Feb 5, 2004, at 12:50 PM, Yann Bizeul wrote:
You can't store custom objects in user defaults without encoding
them.. You'd need to use the value transformer that
archives/unarchives them to NSData.
As I said, I tried to make it NSCoder complient without success. In
fact I thought value transformer were for another level in the
hierarchy : Not for the whome object itself, but for their instance
variable (that will be used as "key" in bindings. I don't know if I'm
clear :
_______ 1 _______ ______ 2 ______ _ 3 __
NSArrayController -> myCustomObject1 -> aValue
-> myCustomObject2 -> aValue
According to me, NSValueDecoder is to decode level 3 variables, not
whole objects in level 2.
I'm not sure why NSValueDecoder comes into play?
NSValueTransformers apply to whatever value the widget is bound to.
So am I wrong, or is there a solution to
archive/unarchive level 2 objects in the NSArrayController
It's not clear what you're trying to achieve with the array controller.
It's up to you to provide your variables in an appropriate form; if
you extract immutable values from NSUserDefaults that are intended to
be mutable, then you should create mutable copies of them before
passing them to the controller (or use a value transformer as mentioned
above).
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.