The paragraph or ruler attributes used by an attributed string.


class NSParagraphStyle : NSObject


The NSParagraphStyle class and its subclass NSMutableParagraphStyle encapsulate the paragraph or ruler attributes used by the NSAttributedString classes. Instances of these classes are often referred to as paragraph style objects or, when no confusion will result, paragraph styles.


Creating an NSParagraphStyle

class var `default`: NSParagraphStyle

Returns the default paragraph style.

Accessing Style Information

var alignment: NSTextAlignment

The text alignment of the receiver.

var firstLineHeadIndent: CGFloat

The indentation of the first line of the receiver.

var headIndent: CGFloat

The indentation of the receiver’s lines other than the first.

var tailIndent: CGFloat

The trailing indentation of the receiver.

var lineHeightMultiple: CGFloat

The line height multiple.

var maximumLineHeight: CGFloat

The receiver’s maximum line height.

var minimumLineHeight: CGFloat

The receiver’s minimum height.

var lineSpacing: CGFloat

The distance in points between the bottom of one line fragment and the top of the next.

var paragraphSpacing: CGFloat

The space after the end of the paragraph.

var paragraphSpacingBefore: CGFloat

The distance between the paragraph’s top and the beginning of its text content.

Accessing Tab Information

var tabStops: [NSTextTab]

An array of NSTextTab objects representing the receiver’s tab stops.

var defaultTabInterval: CGFloat

The document-wide default tab interval.

Getting Text Block and List Information

var textBlocks: [NSTextBlock]

An array specifying the text blocks containing the paragraph.

var textLists: [NSTextList]

An array specifying the text lists containing the paragraph.

Getting Line Breaking Information

var lineBreakMode: NSLineBreakMode

The mode that should be used to break lines in the receiver.

var hyphenationFactor: Float

The paragraph’s threshold for hyphenation.

var tighteningFactorForTruncation: Float

The threshold for using tightening as an alternative to truncation.

var allowsDefaultTighteningForTruncation: Bool

A Boolean value indicating whether the system may tighten inter-character spacing before truncating text.

Getting HTML Header Level

var headerLevel: Int

A Boolean that specifies whether the paragraph is to be treated as a header for purposes of HTML generation.

Writing Direction

class func defaultWritingDirection(forLanguage: String?) -> NSWritingDirection

Returns the default writing direction for the specified language.

var baseWritingDirection: NSWritingDirection

The base writing direction for the receiver.


enum NSLineBreakMode

Constants that specify what happens when a line is too long for its container.

enum NSTextAlignment

These constants specify text alignment.

enum NSWritingDirection

These constants specify the writing directions:

enum NSParagraphStyle.TextTabType

These constants describe the various type of tab stop.

See Also


class NSMutableParagraphStyle

An object that enables changing the values of the subattributes in a paragraph style attribute.

class NSTextTab

A tab in an NSParagraphStyle object, storing an alignment type and location.