• 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: Binding values from an array in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding values from an array in IB


  • Subject: Re: Binding values from an array in IB
  • From: Dustin Voss <email@hidden>
  • Date: Sat, 29 May 2004 15:08:58 -0700

On 28 May, 2004, at 6:46 PM, Christoffer Lerno wrote:

Hi,

I have an NSObjectController based on a NSMutableDictionary. Anyway, binding values to the interface is straightforward for single values of course. However, one of my values is an NSArray and I want to bind each element to a certain NSTextView.

I get the array like this:

NSArray theArray=[objectControllerDictionary objectForKey:@"goods"];

And I want to extract it's values:

NSNumber theOreAmount=[[objectControllerDictionary objectForKey:@"goods"] objectAtIndex:2];

and bind theOreAmount to the value of a NSTextView

Is it possible to create some path, selection.goods.somethingtakingindex2 to get to this value or do I have to go by-way of value transformers?

It sounds like your array should really be a dictionary. You might want to consider making that change.

Another option would be to make the text fields into an NSMatrix, and bind NSMatrix's "content" to "selection.goods". Then there would be a one-to-one correspondence between the fields and the elements of the array.

A third option is to make a subclass of NSArrayController's valueForKeyPath: method, and add in support for a key-path like "selection.goods.@2".
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Binding values from an array in IB (From: Christoffer Lerno <email@hidden>)

  • Prev by Date: Re: How to upload dictionary to online URL
  • Next by Date: Your own NSNotificationCenter
  • Previous by thread: Binding values from an array in IB
  • Next by thread: How to upload dictionary to online URL
  • Index(es):
    • Date
    • Thread