O'Reilly logo

Mac Application Development by Example Beginner's Guide by Robert Wiebe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – writing the didSelect: program code

Once more we can jump right in and start writing the program code for this method as follows:

  1. Start by putting a comment in the NewDefaults.m file that describes the method in plain English as follows:
    /*
        The didSelect delegate method is called whenever
        the Preference Pane is displayed, even if the 
        System Preferences were not quit and relaunched
     */
  2. The method needs to match the interface from the NSPreferencePane.h file because it is a delegate method defined in that file as follows:
    - (void) didSelect
    {
    
    }
  3. Using the readDefaults:forKey: method get the current value for the Finder's hidden files key as an NSString object:
     // Read the current setting for // Showing Hidden files in he Finder NSString ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required