Databases Reference
In-Depth Information
on page 128
). With the
NSTableColumn
selected, we open its Bindings tab in the
inspector and bind its value to the recipe's
NSArrayController
with a controller
key of
arrangedObjects
and a model key path of
name
. Once this is set, our
Recipe
entities show up in this table. More importantly, when we click a recipe in
this list, the recipe becomes the selection that feeds the rest of the UI.
Figure 23—List view tree
Let's add the buttons that will control the creation and removal of
Recipe
entities. For this step, we drag an
NSButton
(it does not matter which one) from
the library and place it below the
Recipe
table view. In the button's Attributes
tab, we set its image to
NSAddTemplate
(a system-level image available for our
use), change its style to
RoundRect
, and remove its title if it has one. In addition,
we must select the menu item Layout > Size to Fit to get the button to the
perfect size. Once these steps have been taken for the add button, select Edit
> Duplicate from the main menu to create a second button, and change the
second button's image to
NSRemoveTemplate
.
Next, we can “wire up” the buttons under the
NSTableView
and connect them
directly to the recipe's
NSArrayController
. The add button will be connected to the
Search WWH ::
Custom Search