• 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
KVC with bindings to array elements?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KVC with bindings to array elements?


  • Subject: KVC with bindings to array elements?
  • From: Jeff Koftinoff <email@hidden>
  • Date: Fri, 20 Oct 2006 06:52:12 -0700

Hi everyone; I'm fairly new to KVC. I have my application working fabulously with my data model. Parameters and sliders and text field's values, min, and max are bound to my objective c object. Parameter validation works great.

However now I want to make an static array of values - each element bound to a different gui control.

What key path do I use to specify the n'th NSNumber in a NSMutableArray? I tried the following:

  myData.params.2
  myData.params.@2
  myData.params@2

And then what is the best way to implement the methods in my object to allow for this?


Or do I have to split them all out of the array and have separate methods for each item like:


- (void) setParams0: (NSNumber *);
 - (void) setParams1 : (NSNumber *);
 - (void) setParams2 : (NSNumber *);
- (NSNumber *) getParams0;
- (NSNumber *) getParams1;
- (NSNumber *) getParams2;

etc...? I can't imagine I must resort to this..

All the examples I find for KVC and arrays are assuming that the array is something to be filled in by the user with dynamic number of items, for table views etc.

Regards,
Jeff Koftinoff


_______________________________________________ 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: KVC with bindings to array elements?
      • From: Hank Heijink <email@hidden>
    • Re: KVC with bindings to array elements?
      • From: Scott Anguish <email@hidden>
  • Prev by Date: NSTextField selectors
  • Next by Date: Is it possible to handle a mouse click in an NSTextView without subclassing it?
  • Previous by thread: NSTextField selectors
  • Next by thread: Re: KVC with bindings to array elements?
  • Index(es):
    • Date
    • Thread