• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inter-class Dependent Keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Inter-class Dependent Keys (From: Jonathon Mah <email@hidden>)

  • Prev by Date: Re: Cocoa from C++ (dont want to mix it)
  • Next by Date: Re: Cocoa from C++ (dont want to mix it)
  • Previous by thread: Re: Inter-class Dependent Keys
  • Next by thread: Re: Inter-class Dependent Keys
  • Index(es):
    • Date
    • Thread