Bind the Pop-up Menu

Now it’s time to bind the user interface elements. Choose Bindings from the menu at the top of the information panel or press Cmd-4. The first user interface element to bind is the pop-up menu. There are three bindings you must set for the pop-up menu. The content binding describes what the collection of objects is. In this example the collection of objects is the objects in the array controller. In Interface Builder, click the disclosure triangle next to the content binding and make the following choices:

Bind to: InputDeviceMenuController
Controller Key: arrangedObjects
Model Key Path: Leave Blank

The contentValues binding describes what will be displayed in the pop-up menu. In this example it will be productName, the name of the input device. Make the following choices for the contentValues binding:

Bind to: InputDeviceMenuController
Controller Key: arrangedObjects
Model Key Path: productName

The selectedObject binding describes the object the user chose from the menu. For a table view you could use the array controller with the controller key selection. But pop-up menus don’t record the selection the user made so the selection controller key doesn’t work. That is why you need the currentlySelectedItem data member of the InputController class. You’re going to bind the selectedObject binding to currentlySelectedItem. Make the following choices for the selectedObject binding:

Bind to: InputController
Controller Key: Leave Blank
Model Key Path: currentlySelectedItem

Next (Bind the Text Fields)

Previous (Create the Controller)