On Jan 19, 2009, at 7:25 PM, Quincey Morris wrote:
If anyone can find a place in any documentation or header files that
*says* the indexed to-many accessors (such as
insertObject:in<Key>AtIndex: and removeObjectFrom<Key>AtIndex:) are
KVO-compliant when used directly, you'd be doing a public service by
posting a link.
While researching an answer for a different thread, I found it:
The description of NSKeyValueChangeKindKey in the NSKeyValueObserving
protocol reference[1] says that:
A value of NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, or
NSKeyValueChangeReplacement indicates that mutating messages have
been sent to the array returned by a mutableArrayValueForKey:
message sent to the object, or that one of the key-value-coding-
compliant array mutation methods for the key has been invoked, or
that willChange:valuesAtIndexes:forKey:/
didChange:valuesAtIndexes:forKey: has otherwise been invoked.
It documents that "the key-value-coding-compliant array mutation
methods" generate change notifications of one of those kinds.
Further, it makes clear, by implication, that KVO does this by hooking
into those methods when a property is being observed and invoking will/
didChange:valuesAtIndexes:forKey: within its overrides.
Cheers,
Ken
[1] http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueObserving_Protocol/Reference/Reference.html#/
/apple_ref/doc/uid/20002299-SW1
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com