• 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 NSTextField to an array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding NSTextField to an array


  • Subject: Re: Binding NSTextField to an array
  • From: Jeremy Hughes <email@hidden>
  • Date: Mon, 06 Mar 2017 13:32:06 +0000

> From what I understand of your example, you’re not “binding” anything in a Cocoa sense.

In the case of the single value, the text field is set up via the Bindings pane of Interface Builder so that “Value" says “Bind to File’s Owner” with a model key path of self.value. (And “value" is declared as dynamic so that Swift will take care of KVO.) This works fine. Is this not a Cocoa binding?

What I don’t understand is why this works for a single value but doesn’t work for an array of values, where I change the model key path to self.values.

> What you is an NSArrayController. Bind your text field to the array controller. Supply the array controller with content, and have it derive the selected value, be it single or multiple.

OK. I now have an array controller that is bound to File’s Owner with a model key path of self.values, and I then bind the text field to the array controller with a Controller Key value of “selection” (although I’m not sure that’s right, because the array is not actually displayed anywhere for users to select items).

Now I get the following error:

Cannot create number from object <_NSControllerObjectProxy: 0x6000000070b0> of class _NSControllerObjectProxy

Jeremy


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: Binding NSTextField to an array
      • From: Jonathan Mitchell <email@hidden>
References: 
 >Binding NSTextField to an array (From: Jeremy Hughes <email@hidden>)
 >Re: Binding NSTextField to an array (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Unicode filenames with Apple File System and UIManagedDocument
  • Next by Date: Re: Binding NSTextField to an array
  • Previous by thread: Re: Binding NSTextField to an array
  • Next by thread: Re: Binding NSTextField to an array
  • Index(es):
    • Date
    • Thread