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

Re: KVC with bindings to array elements?


  • Subject: Re: KVC with bindings to array elements?
  • From: Hank Heijink <email@hidden>
  • Date: Fri, 20 Oct 2006 11:09:11 -0400

You might be better off with an NSDictionary for this. NSArray doesn't support what you're trying to do.

On Oct 20, 2006, at 9:52 AM, Jeff Koftinoff wrote:

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


Hank Heijink www.hankheijink.com email@hidden


_______________________________________________ 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: Jeff Koftinoff <email@hidden>
References: 
 >KVC with bindings to array elements? (From: Jeff Koftinoff <email@hidden>)

  • Prev by Date: Re: KVC with bindings to array elements?
  • Next by Date: Re: drawing NSTextFieldCell nested inside NSTextFieldCell subclass causes crash
  • Previous by thread: Re: KVC with bindings to array elements?
  • Next by thread: Re: KVC with bindings to array elements?
  • Index(es):
    • Date
    • Thread