On Fri, Apr 2, 2010 at 8:25 PM, Jerry Krinock <je...@ieee.org> wrote:
> + (NSSet*)keyPathsForValuesAffectingSelectedFoo {
>    return [NSSet setWithObjects:
>        // Shotgun approach.  Try 'em all!!
>        @"fooArrayController.selectedObjects",
>        @"fooArrayController.selectionIndex",
>        @"fooArrayController.selection",
>        @"fooArrayController.selectionIndexes",
>        @"fooArrayController.selectedObjects",
>        nil] ;
> }

Oh, and also the documentation is quite clear that you can't bind
through a to-many property. So even if NSArrayController did support
prior-value notification, this wouldn't work. From the Key-Value
Technology Compliance section of the Model Object Implementation
Guide:

"Important: Note that you cannot set up dependencies on to-many
relationships. For example, suppose you have an Order object with a
to-many relationship (orderItems) to a collection of OrderItem
objects, and OrderItem objects have a price attribute. You might want
the Order object have a totalPrice attribute that is dependent upon
the prices of all the OrderItem objects in the relationship. You can
not do this by implementing keyPathsForValuesAffectingValueForKey: and
returning orderItems.price as the keypath for totalPrice. You must
observe the price attribute of each of the OrderItem objects in the
orderItems collection and respond to changes in their values by
updating totalPrice yourself."

--Kyle Sluder
_______________________________________________

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

Reply via email to