user1103804
user1103804

Reputation: 157

Font and Font Size Changing

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!

Upvotes: 1

Views: 518

Answers (1)

Parag Bafna
Parag Bafna

Reputation: 22930

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.

Upvotes: 1

Related Questions