Setting default fonts in NSTextView
How can I set the default font of an NSTextView comp开发者_如何学JAVAonent? 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.
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]];
NSFont* font = <whatever>; [textView setFont: font];
精彩评论