Re: Inter-class Dependent Keys
Re: Inter-class Dependent Keys
- Subject: Re: Inter-class Dependent Keys
- From: Jonathon Mah <email@hidden>
- Date: Sat, 12 Mar 2005 02:06:54 +1030
On 5 Mar 2005, at 22:48, Jonathon Mah wrote:
To trigger this change, I do this:
- (void)awakeFromNib
{
[arrayController addObserver:self forKeyPath:@"canSelectNext"
options:NULL context:NULL];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
if (object == arrayController && [keyPath
isEqualToString:@"canSelectNext"])
{
[self willChangeValueForKey:@"myButtonTitle"];
[self didChangeValueForKey:@"myButtonTitle"];
}
}
The thing I don't like about this is the whole
'willChangeValueForKey:' 'didChangeValueForKey:' both being called
after the value has already changed (screwing it up should something
observing 'myButtonTitle' ever want to get the old value).
Sorry to bring this up again, but I haven't yet got an adequate answer.
One way to make this work properly would be to register to receive a
notification when the object _will_ change -- is that possible at all?
Jonathon Mah
email@hidden
_______________________________________________
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