Re: Overriding v alueForKeyPath
Re: Overriding v alueForKeyPath
- Subject: Re: Overriding v alueForKeyPath
- From: Laurent Cerveau <email@hidden>
- Date: Wed, 09 Jul 2008 19:06:11 +0200
Hi Hamish
Thanks for the suggestion : I did in fact sit with a collegue and he
also forced me to look at the other side (KVO ) and we kind of found a
way
Basically the order of calling is valueForKey for the first part of
the "KV path" which goes in valueForUndefinedKey and if this "one does
the right thing" is ends up in valueForKeyPath
We went down further and the best way to force a call done to
"valueForKeyPath" is in fact to return a constant value from the
valueForKey / valueForUndefinedKey . and the simplest one is nil.
now I need to check the proper behavior for observer to make sure they
can observe properly
thanks
laurent
On Jul 9, 2008, at 6:46 PM, Hamish Allan wrote:
On Wed, Jul 9, 2008 at 2:39 PM, Laurent Cerveau <email@hidden>
wrote:
Apparently what is happening is that the keyPath is decomposed,
each object
is verified to be KVC compliant for the appropriate subPath and
here we go :
nothing unexpected if I refer to the doc except that..the part I do
not
understand in this case is the following : why is own
valueForKeyPath for
this object not called at first place in this case?
I'm not sure I'm answering your question directly, but the reason the
KVO machinery wants the object to be genuinely KVC-compliant for the
"title" property is that one of the ways that "title.de" can change is
if "title" changes, so it wants to set itself up to monitor that.
You might consider using a proxy object for the property "title" which
handles the inverted heirarchy?
Hamish
_______________________________________________
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