1

I have a Mac app with a plain-text text view. I have been able to get it to save, etc, but when I change the font or font size in my app using the font panel, it is not saved when the app re-opens.

How can I create a way that my app will save the font and font size changes? Thanks!

Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
user1103804
  • 157
  • 1
  • 2
  • 9

1 Answers1

1

Save Font and Font Size in NSUserDefaults and load from NSUserDefault at the time of application launching.

NSString *valueToSave = @"someValue";
[[NSUserDefaults standardUserDefaults]
    setObject:valueToSave forKey:@"preferenceName"];
to get it back later

NSString *savedValue = [[NSUserDefaults standardUserDefaults]
    stringForKey:@"preferenceName"];

Take a look at Save string to the NSUserDefaults? post.

Community
  • 1
  • 1
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144