Re: setValue:forUndefinedKey:
Re: setValue:forUndefinedKey:
- Subject: Re: setValue:forUndefinedKey:
- From: Keary Suska <email@hidden>
- Date: Wed, 11 Oct 2006 19:10:15 -0600
- Thread-topic: setValue:forUndefinedKey:
on 10/11/06 5:03 PM, email@hidden purportedly said:
> My object has some properties in a dictionary. It is like
> NSManagedObject that has (I guess) the properties in a Dictionary.
> Some of the properties have specific set/get methods, others do not.
> They should all be accessible with key value coding. I have read
> about setValue:forKey:'s search order at this web page:
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/
> KeyValueCoding/Concepts/SearchImplementation.html
>
> My current solution is to implement a setValue:forUndefinedKey: that
> look up in the Dictionary for properties that do not have a separate
> set method. It is working. Is this a good idea or should I override
> setValue:forKey: instead?
Using setValue:forUndefinedKey: is the only way I have found to do this. If
you override setvalue:forkey: you will have to handle KVO notifications in
your override, or your bindings won't update properly. So it's an easier
solution, however inelegant.
Core Data/NSManagedObject is probably a more elegant solution but I haven't
pursued it yet.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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