Re: setValue:forUndefinedKey:
Re: setValue:forUndefinedKey:
- Subject: Re: setValue:forUndefinedKey:
- From: Keary Suska <email@hidden>
- Date: Thu, 12 Oct 2006 11:16:42 -0600
- Thread-topic: setValue:forUndefinedKey:
on 10/12/06 1:39 AM, email@hidden purportedly said:
> Okay, thanks. My problem with overriding setValue:forKey: is that any
> custom set/get methods are not called. I guess my custom
> setValue:forKey: should follow key-value search ordering and look for
> custom set/get methods for the given key. Would like to see some
> examples on how to do this? :)
Yeah, that too. The KVC docs explain the search sequence fairly clearly, and
if you do the same you should be safe. You would use NSSelectorFromString()
and respondsToSelector: for checking (or not, if robustness isn't an issue),
and you will probably need to use NSInvocation to call the methods. There
are likely some parts of the search you can safely omit. Don't forget the
KVO part. All in all, this is why the *forUndefinedKey: methods are easier
to use ;-)
>> Core Data/NSManagedObject is probably a more elegant solution but I
>> haven't
>> pursued it yet.
>
> I am not able to use NSManagedObject on this, but it looks like
> NSManagedObject has solved this issue in some sort. But how?
IMHO, Apple is not very good at explaining what's happening behind the
scenes.
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