Question

I have a Mac application that uses CoreData. I have 1 entity "Employee" with 2 attributes, employeeName and employeePin. I have a drawer window that is used to add employees as well. I want an NSComboBox to be populated with the employeeName attribute from CoreData but I can't figure it out. Ive got CoreData working like it should but I can't figure out how to bind the NSComboBox with that particular attribute.

I created an Array Controller and set the parameter "Managed Object Context" to the App Delegate with the model key path managedObjectContext but Im not getting the names to pull up in the combo box. How do i get the names to pull up in the combo box. Any and all help is appreciated.

Was it helpful?

Solution

To fully set up the array controller you also need to set the mode to 'Entity Name' in the identity inspector of the array controller and specify this as 'Employee'

After that you need to bind the 'content value' of the combo box(in bindings inspector) to employeeName of the array controller. (arrangedObjects).

i.e in the Bindings inspector,

  • click on bind :Array controller
  • Controller Key :arrangedObjects
  • Model Key Path : employeeName
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top