I have added an option to my app to change the background color and textColor of an NSTextField
. I set up an NSPopUpButton
and based on the selected item in the NSPopUpButton
, it changes the colors. I want to save this selection using NSUserDefaults. I am using this method to change the backgroundColor and textColor and it works. How would I save the properties with NSUserDefaults
and have it set on start up?
- (IBAction)addBarColor:(id)sender {
if ([addBarColor.titleOfSelectedItem isEqualToString:@"White"]) {
addressBar.backgroundColor = [NSColor whiteColor];
addressBar.textColor = [NSColor blackColor];
}
else {
//default state
addressBar.backgroundColor = [NSColor redColor];
addressBar.textColor = [NSColor whiteColor];
}
}