• 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
Why can adding an KVO call didChangeValueForKey:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why can adding an KVO call didChangeValueForKey:


  • Subject: Why can adding an KVO call didChangeValueForKey:
  • From: "Ian G. Gillespie" <email@hidden>
  • Date: Thu, 10 Nov 2005 13:35:16 -0500

I have a simple to-many relationships setup using NSTreeControllers with a source-list and contents type UI (ala iTunes). I over-ride awakeFromFetch to add observers of the objects that the object contains like this:

NSArray* newObjects = [[self valueForKey:@"items"] allObjects];
[newObjects addObserver:self
toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [newObjects count])]
forKeyPath:@"name"
options:NSKeyValueObservingOptionNew
context:NULL];



I also overide observeValueForKeyPath:(NSString *)keyPath ofObject: (id)object change:(NSDictionary *)change... to know when the observed objects change. However, it seems that when my application first launches and I select an item from the list on the left the observerValue:keyPath:obObject gets called with the "name" key path even though nothing has changed.


Is this behavior correct? For what it is worth, I am almost certain that prior to 10.4.3 this was not the case.



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Prev by Date: Re: howto mix objc/c++ in a nice way?
  • Next by Date: NSLock locking order;
  • Previous by thread: Re: Speeding up creation of NSDictionary from XML? (iTunes related)
  • Next by thread: NSLock locking order;
  • Index(es):
    • Date
    • Thread