• 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: Bind to element in dictionary in array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bind to element in dictionary in array


  • Subject: Re: Bind to element in dictionary in array
  • From: George Orthwein <email@hidden>
  • Date: Wed, 28 Jun 2006 15:05:44 -0400

You can't bind to an array like that. The confusing part for me is
that [dict valueForKeyPath:@"MyArray.element1.someBoolValueD"] will
return a perfectly fine array,

First off, sorry I misread your model, what I meant was [Dict valueforKeyPath:@"MyArray.someBoolValueD"] would return an array (containing each element's value for someBoolValueD).



Secondly, I misunderstood what you were asking:
dict.MyArray[index].someBoolValueD <- this does not seem to work

As far as I know, there is no way to specify [index] so that you get a particular entry in the array.


The only ways I can think to work around that is:
- keep a local variable set to that array element (which you said you didn't want to do)
- use a dict instead of an array so you can refer to each entry by name (even if the names are "element1", "element2", etc)


A dict seems to make more sense than an array anyway. Since you would have to know how many members are going to be in the array in order to bind to a particular element... I'm guessing adding to dict instead with a particular key name shouldn't be a problem.

Maybe someone else can step in and confirm that these are the only options.

George

p.s.

What is the ObjectClassName? The same as my PrefPane?

If you were to do that setup (for say, a table view) the Object Class Name would just be NSMutableDictionary, since that is what each element of the array is.
_______________________________________________
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: Bind to element in dictionary in array
      • From: Trygve Inda <email@hidden>
References: 
 >Re: Bind to element in dictionary in array (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Is there another way to do performSelectorOnMainThread?
  • Next by Date: Re: Implementing a TCP port listener in Cocoa
  • Previous by thread: Re: Bind to element in dictionary in array
  • Next by thread: Re: Bind to element in dictionary in array
  • Index(es):
    • Date
    • Thread