O'Reilly logo

Mac OS® X Advanced Development Techniques by Joe Zobkiw

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

A. Source Code

Chapter 3—RadarWatcher

AppController.h

#import <Cocoa/Cocoa.h>@class PreferenceController;@interface AppController : NSObject{    PreferenceController *preferenceController;}- (IBAction)showPreferencePanel:(id)sender;@end

AppController.m

#import "AppController.h"#import "PreferenceController.h"@implementation AppController+ (void)initialize{    // Create the user defaults dictionary    NSUserDefaults *defaults;    defaults = [NSUserDefaults standardUserDefaults];    if ([defaults integerForKey:pkeyInitialized] == 0) {        // Save our defaults if not already initialized        [defaults setObject:[NSNumber numberWithInt:1] forKey:pkeyInitialized];        [defaults setObject:[NSNumber numberWithInt:NSOnState]            forKey:pkeyOpenNewWindow]; ...

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