DTCoreTextParagraphStyle Class Reference
| Inherits from | NSObject |
| Conforms to | NSCopying |
| Declared in | DTCoreTextParagraphStyle.h |
Overview
DTCoreTextParagraphStyle encapsulates the paragraph or ruler attributes used by the NSAttributedString classes on iOS. It is a replacement for NSParagraphStyle which is not implemented on iOS.
Since NSAttributedString instances use CTParagraphStyle object there are methods to bridge from and to these. Because of this distinction there is no need for a mutable variant of this class.
Tasks
Creating a DTCoreTextParagraphStyle
Bridging to and from CTParagraphStyle
-
+ paragraphStyleWithCTParagraphStyle: -
– initWithCTParagraphStyle: -
– createCTParagraphStyle -
+ paragraphStyleWithNSParagraphStyle: -
– NSParagraphStyle
Accessing Style Information
-
firstLineHeadIndentproperty -
defaultTabIntervalproperty -
paragraphSpacingBeforeproperty -
paragraphSpacingproperty -
lineHeightMultipleproperty -
minimumLineHeightproperty -
maximumLineHeightproperty -
tailIndentproperty -
headIndentproperty -
alignmentproperty -
baseWritingDirectionproperty
Setting Tab Stops
Interacting with CSS
Setting Text Lists
-
textListsproperty
Setting Text Blocks
-
textBlocksproperty
Properties
alignment
The text alignment of the receiver.
@property (nonatomic, assign) CTTextAlignment alignmentDiscussion
Natural text alignment is realized as left or right alignment depending on the line sweep direction of the first script contained in the paragraph.
Declared In
DTCoreTextParagraphStyle.hbaseWritingDirection
The base writing direction for the receiver.
@property (nonatomic, assign) CTWritingDirection baseWritingDirectionDeclared In
DTCoreTextParagraphStyle.hdefaultTabInterval
The document-wide default tab interval.
@property (nonatomic, assign) CGFloat defaultTabIntervalDiscussion
The default tab interval in points. Tabs after the last specified in tabStops are placed at integer multiples of this distance (if positive). Default return value is 0.0.
Declared In
DTCoreTextParagraphStyle.hfirstLineHeadIndent
The indentation of the first line of the receiver.
@property (nonatomic, assign) CGFloat firstLineHeadIndentDeclared In
DTCoreTextParagraphStyle.hheadIndent
The distance in points from the leading margin of a text container to the beginning of lines other than the first. This value is always nonnegative.
@property (nonatomic, assign) CGFloat headIndentDeclared In
DTCoreTextParagraphStyle.hlineHeightMultiple
The line height multiple.
@property (nonatomic, assign) CGFloat lineHeightMultipleDiscussion
Internally line height multiples get converted into minimum and maximum line height.
Declared In
DTCoreTextParagraphStyle.hmaximumLineHeight
The maximum height in points that any line in the receiver will occupy, regardless of the font size or size of any attached graphic. This value is always nonnegative. The default value is 0.
@property (nonatomic, assign) CGFloat maximumLineHeightDeclared In
DTCoreTextParagraphStyle.hminimumLineHeight
The minimum height in points that any line in the receiver will occupy, regardless of the font size or size of any attached graphic. This value is always nonnegative.
@property (nonatomic, assign) CGFloat minimumLineHeightDeclared In
DTCoreTextParagraphStyle.hparagraphSpacing
The space after the end of the paragraph.
@property (nonatomic, assign) CGFloat paragraphSpacingDeclared In
DTCoreTextParagraphStyle.hparagraphSpacingBefore
The distance between the paragraph’s top and the beginning of its text content.
@property (nonatomic, assign) CGFloat paragraphSpacingBeforeDeclared In
DTCoreTextParagraphStyle.htabStops
The CTTextTab objects, sorted by location, that define the tab stops for the paragraph style.
@property (nonatomic, copy) NSArray *tabStopsDeclared In
DTCoreTextParagraphStyle.htailIndent
The distance in points from the margin of a text container to the end of lines.
@property (nonatomic, assign) CGFloat tailIndentDiscussion
Note: This value is negative if it is to be measured from the trailing margin, positive if measured from the same margin as the headIndent.
Declared In
DTCoreTextParagraphStyle.htextBlocks
Text blocks containing the paragraph, nested from outermost to innermost, to array. Each text block is a DTTextBlock object.
@property (nonatomic, copy) NSArray *textBlocksDeclared In
DTCoreTextParagraphStyle.htextLists
Text lists containing the paragraph, nested from outermost to innermost. Each text list is a DTCSSListStyle object.
@property (nonatomic, copy) NSArray *textListsDeclared In
DTCoreTextParagraphStyle.hClass Methods
defaultParagraphStyle
Returns the default paragraph style.
+ (DTCoreTextParagraphStyle *)defaultParagraphStyleDeclared In
DTCoreTextParagraphStyle.hparagraphStyleWithCTParagraphStyle:
Create a new paragraph style instance from a CTParagraphStyle.
+ (DTCoreTextParagraphStyle *)paragraphStyleWithCTParagraphStyle:(CTParagraphStyleRef)ctParagraphStyleParameters
- ctParagraphStyle
the
CTParagraphStylefrom which to copy this new style’s attributes.
Declared In
DTCoreTextParagraphStyle.hparagraphStyleWithNSParagraphStyle:
Create a new paragraph style instance from an NSParagraphStyle.
+ (DTCoreTextParagraphStyle *)paragraphStyleWithNSParagraphStyle:(NSParagraphStyle *)paragraphStyleParameters
- paragraphStyle
the
NSParagraphStylefrom which to copy this new style’s attributes.
Discussion
Note: on iOS no tab stops are supported.
Declared In
DTCoreTextParagraphStyle.hInstance Methods
NSParagraphStyle
Create a new NSParagraphStyle from the receiver for use as attribute in NSAttributedString.
- (NSParagraphStyle *)NSParagraphStyleReturn Value
The NSParagraphStyle based on the receiver’s attributes.
Discussion
Note: This method is requires iOS 6 or greater. This does not support tab stops.
Declared In
DTCoreTextParagraphStyle.haddTabStopAtPosition:alignment:
Adds a tab stop to the receiver.
- (void)addTabStopAtPosition:(CGFloat)position alignment:(CTTextAlignment)alignmentDeclared In
DTCoreTextParagraphStyle.hcreateCTParagraphStyle
Create a new CTParagraphStyle from the receiver for use as attribute in NSAttributedString
- (CTParagraphStyleRef)createCTParagraphStyleReturn Value
The CTParagraphStyle based on the receiver’s attributes.
Declared In
DTCoreTextParagraphStyle.h