• 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: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?


  • Subject: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 2 Apr 2010 21:42:49 -0700

On Fri, Apr 2, 2010 at 8:25 PM, Jerry Krinock <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
      • From: Quincey Morris <email@hidden>
References: 
 >Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
  • Next by Date: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
  • Previous by thread: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
  • Next by thread: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
  • Index(es):
    • Date
    • Thread