Saving is almost easier!
Saving is almost easier!
- Subject: Saving is almost easier!
- From: deekpyro <email@hidden>
- Date: Sun, 31 Mar 2002 15:01:01 -0600
Ok, I think I've got most of it, but it still doesn't work:
#import "Controller.h"
NSString *STSCheckBoxKey = @"WBC Enabled";
@implementation Controller
+ (void)initialize
{
// Create a dictionary
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
// Put the values in the dictionary
[defaultValues setObject:[NSNumber numberWithBool:YES]
forKey:STSCheckBoxKey];
// Register the dictionary of defaults
[[NSUserDefaults standardUserDefaults] registerDefaults: defaultValues];
NSLog(@"registered default: %@", defaultValues);
}
- (void)windowDidLoad
{
NSUserDefaults *defaults;
defaults = [NSUserDefaults standardUserDefaults];
[theCheckBoxWBC setState:[defaults boolForKey:STSCheckBoxKey]];
}
// actions //
- (IBAction)theCheckBoxWBCClicked:(id)sender
{
[[NSUserDefaults standardUserDefaults] setBool:[sender state] forKey:
STSCheckBoxKey];
}
What do you think?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.