Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Java


[Previous] [Class List] [Next]

NSString Additions


Inherits from: NSObject
Declared in: AppKit/NSStringDrawing.h




Class Description


The Application Kit adds three methods to the NSString class to support drawing string objects directly in an NSView: drawAtPoint:withAttributes:, drawInRect:withAttributes:, and sizeWithAttributes:. The Application Kit adds similar method the NSAttributedString class. The two drawing methods draw a string object with a single set of attributes that apply to the entire string. To draw a string with multiple attributes, such as multiple text fonts, you must use an NSAttributedString.


Method Types


Drawing an NSString
- drawAtPoint:withAttributes:
- drawInRect:withAttributes:
- sizeWithAttributes:


Instance Methods



drawAtPoint:withAttributes:

- (void)drawAtPoint:(NSPoint)aPoint withAttributes:(NSDictionary *)attributes

Draws the receiver with the font and other display characteristics of attributes, at aPoint in the currently focused NSView. You should only invoke this method when an NSView has PostScript focus.

See Also: - lockFocus (NSView)



drawInRect:withAttributes:

- (void)drawInRect:(NSRect)aRect withAttributes:(NSDictionary *)attributes

Draws the receiver with the font and other display characteristics of attributes, within aRect in the currently focused NSView. You should only invoke this method when an NSView has PostScript focus.

See Also: - lockFocus (NSView)



sizeWithAttributes:

- (NSSize)sizeWithAttributes:(NSDictionary *)attributes

Returns the bounding box size the receiver occupies when drawn with attributes.


[Previous] [Next]