How to configure bindings for NSPopUpButton

I want to bind an NSPopUpButton selection to one of the predefined values. To make it easier to submit an application for a blog: I would have BlogPost, and Categorythe essence (Core Data, although it does not matter), and each object BlogPosthas a reference to one of the objects Category(in the property Category).

I want the user to change the category through NSPopUpButton, so in my XIB I have an NSArrayController that contains all the possible categories and I bind the Content Values ​​button to:

  • Bind to: categoriesArrayController
  • Controller Key: apartObjects
  • Model Key: Name

This is nicely populated with pop-up headers of all categories. I can also associate the selected object with:

  • Bind to: blogObjectController (or directly to the object Blog)
  • Controller Key: Select
  • Model Key: Category

This work and the correct category are selected in the pop-up window, however changing the selection does not change the category the blog entry is in, but instead changes the title of the publication category to the selected value.

, , onlyObjects ( ), . Category . , description ( Core Data - <Category 0x1002b6990> (entity: Category; id: .......).

, NSValueTransformer (). , . , (, , ).

- - , ?

, !

PS: :)

+5
1

:

NSPopupButton:

  • : categoriesArrayController ControllerKey: arrangedObjects
  • Bind : categoryArrayController ControllerKey: arrangedObjects :
  • : blogObjectController ControllerKey: (empty) : content.category
+7

All Articles