O'Reilly logo

Cocoa® Programming for Mac® OS X, Fourth Edition by Aaron Hillegass, Adam Preble

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 20. Drawing Text with Attributes

The next step is to get the string to appear in our view. At the end of this chapter, your application will look like Figure 20.1. The character being displayed will change as you type.

Figure 20.1. Completed Application

Image

NSFont

Overall, the class NSFont has only two types of methods:

1. Class methods for getting the font you want

2. Methods for getting metrics on the font, such as letter height

The following are commonly used methods in NSFont:

+ (NSFont *)userFontOfSize:(float)fontSize+ (NSFont *)userFixedPitchFontOfSize:(float)fontSize+ (NSFont *)messageFontOfSize:(float)fontSize+ (NSFont *)toolTipsFontOfSize:(float)fontSize ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required