8.11. Application Preferences
Cocoa doesn't provide any special support for application preference windows, other than reserving a menu item for Preferences in new application nib files. You can simply apply the techniques and short-cuts you learned in earlier examples to build a window with controls, record the values when they change, and tell other parts of the application that they need to respond to that change. Cocoa Bindings do a very good job of managing this kind of problem.
In this example, you add a simple preference window to Slide Master, shown here in Figure 8-35. This window runs as a modal dialog just to keep things simple. You will use Cocoa Bindings to manage the values of the controls in your window, and observe the changes as they happen.
Figure 8.35. Figure 8-35
You complete the following Try It Out in two steps:
First, you build the new user interface, including binding these controls with Cocoa Bindings.
Then, you complete the custom code required to run the window modally and interpret the values.
8.11.1.
8.11.1.1. Try It Out: Creating a Preference Window Interface
Open Slide Master's MainMenu nib file in Interface Builder.
Add an orderFrontPreferencePanel: action to the First Responder. Remember you can edit the First Responder instance from the Classes tab.
Connect your menu bar's Slide MasterPreferences menu item to the First Responder's orderFrontPreferencePanel ...
Get Beginning Mac OS® X Programming 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.