Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access