• 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: (no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


  • Subject: Re: (no subject)
  • From: John Timmer <email@hidden>
  • Date: Thu, 02 Jun 2005 18:35:00 -0400

Title: Re: (no subject)
I bound it to the Person Array Controller, using a Controller Key of selection, and a model key of addresses.@count.  I was thinking that this should take the currently selected Person, get their addresses & display a count of how many there were.  When I start adding addresses, I get an exception:

[<NSManagedObject 0x3a5380> addObserver:<NSArrayController 0x570d500> forKeyPath:@"addresses.@count" options:0x0 context:0x0] was sent to an object that is not KVC-compliant for the "addresses" property.]

In looking thru the docs, it appears that relationship properties would naturally return an NSSet.  I tried varying the binding to use addresses.count (count being a valid method name in NSSet), but still no joy.  Is it possible to do what I want with the basic NSManagedObject instead of subclassing to create an addressCount method?

Unfortunately, as your error noted, the count property is not key/value coding compliant, since you can’t set the count, only read it.  As such, you can’t bind an editable value to the count of a set or array.  I know that for basic text fields, binding to a displayPattern with keys like @count works nicely.  Whether it would work for the value of the text field, I’m not sure.  I also haven’t tried setting a table column as non-editable and checked if bindings work in that context.

JT


_______________________________________________
This mind intentionally left blank
 _______________________________________________
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

  • Follow-Ups:
    • Re: Core Data Relationship Binding
      • From: Niels Meersschaert <email@hidden>
References: 
 >(no subject) (From: Niels Meersschaert <email@hidden>)

  • Prev by Date: Re: NSTableView - need something like tableView:shouldSelectRow:byExtendingSelection:?
  • Next by Date: Re: Core Data Relationship Binding
  • Previous by thread: (no subject)
  • Next by thread: Re: Core Data Relationship Binding
  • Index(es):
    • Date
    • Thread