Inherits from NSObject
Declared in DTCoreTextLayouter.h

Overview

This class owns an attributed string and is able to create layoutFrames for certain ranges in this string. Optionally it caches these layout frames.

Tasks

Creating a Layouter

Creating Layout Frames

Getting Information

Properties

attributedString

The attributed string that the layouter currently owns

@property (nonatomic, strong) NSAttributedString *attributedString

Declared In

DTCoreTextLayouter.h

framesetter

The internal framesetter of the receiver

@property (nonatomic, readonly) CTFramesetterRef framesetter

Declared In

DTCoreTextLayouter.h

shouldCacheLayoutFrames

If set to YES then the receiver will cache layout frames generated with layoutFrameWithRect:range: for a given rect

@property (nonatomic, assign) BOOL shouldCacheLayoutFrames

Declared In

DTCoreTextLayouter.h

Instance Methods

initWithAttributedString:

Designated Initializer. Creates a new Layouter with an attributed string

- (id)initWithAttributedString:(NSAttributedString *)attributedString

Parameters

attributedString

The NSAttributedString to layout for

Return Value

An initialized layouter

Declared In

DTCoreTextLayouter.h

layoutFrameWithRect:range:

Creates a layout frame with a given rectangle and string range. The layouter fills the layout frame with as many lines as fit. You can query [DTCoreTextLayoutFrame visibleStringRange] for the range the fits and create another layout frame that continues the text from there to create multiple pages, for example for an e-book.

- (DTCoreTextLayoutFrame *)layoutFrameWithRect:(CGRect)frame range:(NSRange)range

Parameters

frame

The rectangle to fill with text

range

The string range to fill, pass {0,0} for the entire string (as much as fits)

Declared In

DTCoreTextLayouter.h