- Inherits from:
- NSObject
- Package:
- com.apple.yellow.application
NSParagraphStyle 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, as paragraph styles.
A paragraph style object represents a complex attribute value in an attributed string, storing a number of sub-attributes that affect paragraph layout for the characters of the string. Among these sub-attributes are alignment, tab stops, and indents. See the method descriptions for more information on each sub-attribute.
These constants specify what happens when a line is too long for its container:
Value | Meaning |
LineBreakByWordWrapping |
Wrapping occurs at word boundaries, unless the word itself doesn't fit on a single line. |
LineBreakByCharWrapping |
Wrapping occurs before the first character that doesn't fit. |
LineBreakByClipping |
Lines are simply not drawn past the edge of the text container. |
LineBreakByTruncatingHead |
Each line is displayed so that the end fits in the container and the missing text is indicated by some kind of ellipsis glyph. |
LineBreakByTruncatingTail |
Each line is displayed so that the beginning fits in the container and the missing text is indicated by some kind of ellipsis glyph. |
LineBreakByTruncatingMiddle |
Each line is displayed so that the beginning and end fit in the container and the missing text is indicated by some kind of ellipsis glyph in the middle. |
These constants the type of tab stop:
Value | Meaning |
LeftTabStopType |
Description forthcoming. |
RightTabStopType |
Description forthcoming. |
CenterTabStopType |
Description forthcoming. |
DecimalTabStopType |
Description forthcoming. |
- Constructors
- NSParagraphStyle
- Creating an NSParagraphStyle
- defaultParagraphStyle
- Accessing style information
- alignment
- firstLineHeadIndent
- headIndent
- tailIndent
- tabStops
- lineBreakMode
- maximumLineHeight
- minimumLineHeight
- lineSpacing
- paragraphSpacing
public NSParagraphStyle()
public static NSParagraphStyle defaultParagraphStyle()
Sub-Attribute | Default Value |
Alignment | NaturalTextAlignment |
Tab stops | 12 left-aligned tabs, spaced by 28.0 points |
Line break mode | LineBreakByWordWrapping |
All others | 0.0 |
See individual method descriptions for explanations of each sub-attribute.
public int alignment()
NSText.LeftTextAlignment
NSText.RightTextAlignment
NSText.CenterTextAlignment
NSText.JustifiedTextAlignment
NSText.NaturalTextAlignment
Natural text alignment is realized as left or right alignment depending on the line sweep direction of the first script contained in the paragraph.
See Also: setAlignment (NSMutableParagraphStyle)
public float firstLineHeadIndent()
See Also: headIndent, tailIndent, setFirstLineHeadIndent (NSMutableParagraphStyle)
public float headIndent()
See Also: firstLineHeadIndent, tailIndent, setHeadIndent (NSMutableParagraphStyle)
public int lineBreakMode()
See Also: setLineBreakMode (NSMutableParagraphStyle)
public float lineSpacing()
See Also: maximumLineHeight, minimumLineHeight, paragraphSpacing, setLineSpacing (NSMutableParagraphStyle)
public float maximumLineHeight()
Although this limit applies to the line itself, line spacing adds extra space between adjacent lines.
See Also: minimumLineHeight, lineSpacing, setMaximumLineHeight (NSMutableParagraphStyle)
public float minimumLineHeight()
See Also: maximumLineHeight, lineSpacing, setMinimumLineHeight (NSMutableParagraphStyle)
public float paragraphSpacing()
See Also: lineSpacing, setParagraphSpacing (NSMutableParagraphStyle)
public NSArray tabStops()
See Also: location (NSTextTab), setTabStops (NSMutableParagraphStyle), addTabStop (NSMutableParagraphStyle), removeTabStop (NSMutableParagraphStyle)
public float tailIndent()
For example, a paragraph style designed to fit exactly in a 2-inch wide container has a head indent of 0.0 and a tail indent of 0.0. One designed to fit with a quarter-inch margin has a head indent of 0.25 and a tail indent of -0.25.
See Also: headIndent, firstLineHeadIndent, setTailIndent: (NSMutableParagraphStyle)