[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re[6]: Recent key-value encoding changes to NSObject.
From: |
Nicola Pero |
Subject: |
Re: Re[6]: Recent key-value encoding changes to NSObject. |
Date: |
Mon, 11 Feb 2002 18:10:22 +0000 (GMT) |
> >| I suggest that you do as follows in your custom subclass -
> >|
> [...]
> >| /* If there is an ivar, use it. */
> >| This should support all your needs -
> >|
> >| ivars take precedence over everything else.
> >| dictionary values take precedence over getXXX.
> >| getXXX are still used when all else fails.
>
> But getXXX should be called before ivar access (during the valueForKey
> process). :-(
You can use storedValueForKey: which looks up ivars before set/get
methods.
So I suppose you could change as follows -
- (id) storedValueForKey: xxx
{
if (ivar)
{
return [super storedValueForKey: xxx];
}
if (canFindInDictionary)
{
return valueFoundInDictionary;
}
return [super storedValueForKey: xxx];
}
- (id) valueForKey: xxx
{
if (ivar)
{
/* Call storedValueForKey: as that looks up ivars first! */
return [super storedValueForKey: xxx];
}
if (canFindInDictionary)
{
return valueFoundInDictionary;
}
/* Call super's implementation. */
return [super valueForKey: xxx];
}
Modulo all approximations and code to fill in, it might work. :-)
- Re[6]: Recent key-value encoding changes to NSObject., (continued)
Re: Recent key-value encoding changes to NSObject., Richard Frith-Macdonald, 2002/02/11
Re: Re[2]: Recent key-value encoding changes to NSObject., Nicola Pero, 2002/02/11
Re[4]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/11
Re: Re[4]: Recent key-value encoding changes to NSObject., Nicola Pero, 2002/02/11
Re[6]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/11
Re: Re[6]: Recent key-value encoding changes to NSObject.,
Nicola Pero <=
Re[8]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/11
Re: Re[6]: Recent key-value encoding changes to NSObject., Richard Frith-Macdonald, 2002/02/11
Re[4]: Recent key-value encoding changes to NSObject., Manuel Guesdon, 2002/02/23