• 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
NSKeyValueBinding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSKeyValueBinding


  • Subject: NSKeyValueBinding
  • From: Development <email@hidden>
  • Date: Tue, 15 May 2007 17:43:33 -0700

I've spent a couple hours now in the mailing list archive, google and the dev site... and either what I'm looking for does not exist or i do not understand what I am seeing. I am trying to use sort descriptors to sort values in a custom object. So here's the information.

I have a custom object that is basically little more than a branch/ leaf node structure. It is used to hold data for display in an outline view. It only allows a single level. In other words a branch can only have leaves and no further branches. thus it is an exceedingly simple structure.
What I am trying to do is Either use the keybindings in IB or make my own so that I can use [[root children] sortedArrayUsingDescriptors:desc]; to sort the root directory's children. (and also to sort any of the children's contents when a "Sort selected" menu item is clicked.) Well when I try to sort with that function I get this error in the runlog: [<NodeItem 0x377090> valueForUndefinedKey:]: this class is not key value coding-compliant for the key ItemName.
I am assuming this means I need to use the NSKeyValueBinding but I simply do not understand how it functions. I looked for example code and found nothing so I don't even have a working example to study. At first I thought all I'd need to do is add an objectForKey: method to the node but that did not help.
So what I have not been able to figure out is how to make my NodeItem class key value coding compliant. Like I said I just don't understand what I'm reading on the website, and am not entirely sure the answer I am looking for is there. Does any one know of an example that does this?


Of what I have read, I believe I am suppose to use: - (void)bind: (NSString *)binding toObject:(id)observable withKeyPath:(NSString *) keyPath options:(NSDictionary *)options to accomplish this compliance and this is the breakdown... I don't understand the documentation.

What I think i understand is: bind:@"ItemName" toObject:NodeItem (i have no idea if this is right) I am totaly lost when I get to withkeypath and options.

Thank you.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSKeyValueBinding
      • From: mmalc crawford <email@hidden>
  • Prev by Date: text in tableview animating inappropriately
  • Next by Date: Re: NSKeyValueBinding
  • Previous by thread: text in tableview animating inappropriately
  • Next by thread: Re: NSKeyValueBinding
  • Index(es):
    • Date
    • Thread