• 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: Core data binding "first" of to-many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core data binding "first" of to-many relationship


  • Subject: Re: Core data binding "first" of to-many relationship
  • From: Sean McBride <email@hidden>
  • Date: Sat, 27 Nov 2010 19:06:42 -0500

On Nov 27, 2010, at 17:44, Jerry Krinock wrote:

>> I have an NSArrayController that holds a set of persons. These persons have a to-many relationship of name objects. Usually they will only have one name, but there may be multiple (or even no name).
>>
>> In my interface, I have an NSTableView that will display the persons. The attributes are easy enough (gender, etc), but how can I bind the names to a column so only one name is shown for a person?
>
> Good old-fashioned code to the rescue.  Implement a method in your Person class which returns such a name, and bind the table column to it.  I think that as long as the column is not editable, you will not need a setter.

Additionally, in your Person class, implement keyPathsForValuesAffectingValueForKey: so that when the 'names' relationship changes, your 'primaryName' key does too.

Sean

_______________________________________________

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

References: 
 >Core data binding "first" of to-many relationship (From: Mikkel Eide Eriksen <email@hidden>)
 >Re: Core data binding "first" of to-many relationship (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Core data binding "first" of to-many relationship
  • Next by Date: Organize a file
  • Previous by thread: Re: Core data binding "first" of to-many relationship
  • Next by thread: Icon Designer?
  • Index(es):
    • Date
    • Thread