Connecting the Add Employee Button

Now that you have set up bindings from the table view to the array controller, the next step is to hook up the Add Employee button.

Unlike what you have done in previous exercises, in this exercise you will not set the buttons’ target to be File's Owner (recall that in this case, File's Owner is the document). Instead, NSArrayController is again going to come to your aid to serve as a controller object and augment your Document class: The array controller will be the target of the buttons, and their actions will be methods on NSArrayController (Figure 9.9).

Figure 9.9  The wiring between the buttons and the array controller

Control-drag from the Add Employee button to the Array Controller ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.