cocoa - Setting the font of an NSTextView -


I'm subclassing NSTextView to set it to default font:

PTNfoEditField.h

  @interface PTNfoEditField: NSTextView {} @end  

PTNfoEditField.m

  @implementation PTNfoEditField - (id) init {if ( Self = [Super Init]) [[[Self TextStorage] Set font: [NSFont fontname: @ "courier" size: 10]]; } Healthy return; } @end  

However, this does not work and I do not know how to do this in a different way. Can somebody help me out? Thank you.

is not the beginning init for the view; it initWithFrame: . In addition, if your idea is in neutral, you have to override the initWithCoder: . Ensure that your view is actually a PTNfoEditField, not regular NSTextView

In addition, you should use [NSFont userFixedPitchFontOfSize: 0.0] to set the font. You must not strictly have the name of the font (user can prefer the better monospace font) nor the font size (the user can find a 10-step link difficult to read or set up its anti-aliasing threshold is).


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -