Cocoa – Setting default fonts in NSTextView

cocoa

How can I set the default font of an NSTextView component? I need to have an area in my app where users can make changes to a plain text file, and I'd like for the font to be a monospaced font.

Best Answer

Found it. This answer was close, but wouldn't do it - had to access the textStorage object of the NSTextView first:

[[myNSTextView textStorage] setFont:[NSFont fontWithName:@"Menlo" size:11]];
Related Topic