段落样式 |
说明 |
lineSpacing |
字体的行间距 |
parStyle.paragraphSpacing |
段落之间的间距 |
parStyle.alignment |
文本对齐方式 |
firstLineHeadIndent |
每段首行缩进 |
parStyle.headIndent |
除每段第一行以外的缩进 |
parStyle.tailIndent |
尾部缩进 ????? |
lineBreakMode |
内容显示不完全时的省略方式 |
minimumLineHeight |
最低行高(设置最低行高后,如果文本小于20行,会通过增加行间距达到20行的高度) |
maximumLineHeight |
最高行高(设置最高行高后,如果文本大于10行,会通过降低行间距达到10行的高度) |
baseWritingDirection |
写入方向 |
lineHeightMultiple |
在受到最小和最大行高约束之前,自然线高度乘以该因子(如果为正) 多少倍行间距 |
paragraphSpacingBefore |
段落顶部与文本内容开头之间的距离 |
hyphenationFactor |
段落的连字属性 ????? |
tabStops |
一组NSTextTabs。 内容应按位置排序。 默认值是一个由12个左对齐制表符组成的数组,间隔为28pt ????? |
defaultTabInterval |
文档范围的默认选项卡间隔 ????? |
allowsDefaultTighteningForTruncation |
一个布尔值,指示系统在截断文本之前是否可以收紧字符间间距 ????? |
@property (class, readonly, copy, NS_NONATOMIC_IOSONLY) NSParagraphStyle *defaultParagraphStyle; // This class property returns a shared and cached NSParagraphStyle instance with the default style settings, with same value as the result of [[NSParagraphStyle alloc] init].
+ (NSWritingDirection)defaultWritingDirectionForLanguage:(nullable NSString *)languageName; // languageName is in ISO lang region format
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat lineSpacing; // "Leading": distance between the bottom of one line fragment and top of next (applied between lines in the same container). This value is included in the line fragment heights in layout manager.
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacing; // Distance between the bottom of this paragraph and top of next (or the beginning of its paragraphSpacingBefore, if any).
@property (readonly, NS_NONATOMIC_IOSONLY) NSTextAlignment alignment;
// The following values are relative to the appropriate margin (depending on the paragraph direction)
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat headIndent; // Distance from margin to front edge of paragraph
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat tailIndent; // Distance from margin to back edge of paragraph; if negative or 0, from other margin
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat firstLineHeadIndent; // Distance from margin to edge appropriate for text direction
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat minimumLineHeight; // Line height is the distance from bottom of descenders to top of ascenders; basically the line fragment height. Does not include lineSpacing (which is added after this computation).
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat maximumLineHeight; // 0 implies no maximum.
@property (readonly, NS_NONATOMIC_IOSONLY) NSLineBreakMode lineBreakMode;
@property (readonly, NS_NONATOMIC_IOSONLY) NSWritingDirection baseWritingDirection;
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat lineHeightMultiple; // Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height.
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat paragraphSpacingBefore; // Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph.
// Specifies the threshold for hyphenation. Valid values lie between 0.0 and 1.0 inclusive. Hyphenation will be attempted when the ratio of the text width as broken without hyphenation to the width of the line fragment is less than the hyphenation factor. When this takes on its default value of 0.0, the layout manager's hyphenation factor is used instead. When both are 0.0, hyphenation is disabled.
@property (readonly, NS_NONATOMIC_IOSONLY) float hyphenationFactor;
@property (readonly,copy, NS_NONATOMIC_IOSONLY) NSArray<NSTextTab *> *tabStops NS_AVAILABLE(10_0, 7_0); // An array of NSTextTabs. Contents should be ordered by location. The default value is an array of 12 left-aligned tabs at 28pt interval
@property (readonly, NS_NONATOMIC_IOSONLY) CGFloat defaultTabInterval NS_AVAILABLE(10_0, 7_0); // The default tab interval used for locations beyond the last element in tabStops
@property (readonly, NS_NONATOMIC_IOSONLY) BOOL allowsDefaultTighteningForTruncation NS_AVAILABLE(10_11, 9_0); // Tightens inter-character spacing in attempt to fit lines wider than the available space if the line break mode is one of the truncation modes before starting to truncate. NO by default. The maximum amount of tightening performed is determined by the system based on contexts such as font, line width, etc.
NSLineBreakMode |
说明 |
NSLineBreakByWordWrapping |
以单词为显示单位显示,后面部分省略不显示 |
NSLineBreakByCharWrapping |
以字符为显示单位显示,后面部分省略不显示 |
NSLineBreakByClipping |
剪切与文本宽度相同的内容长度,后半部分被删除 |
NSLineBreakByTruncatingHead |
前面部分文字以……方式省略,显示尾部文字内容 |
NSLineBreakByTruncatingTail |
中间的内容以……方式省略,显示头尾的文字内容 |
NSLineBreakByTruncatingMiddle |
结尾部分的内容以……方式省略,显示头的文字内容 |
typedef NS_ENUM(NSInteger, NSLineBreakMode) {
NSLineBreakByWordWrapping = 0, // Wrap at word boundaries, default
NSLineBreakByCharWrapping, // Wrap at character boundaries
NSLineBreakByClipping, // Simply clip
NSLineBreakByTruncatingHead, // Truncate at head of line: "...wxyz"
NSLineBreakByTruncatingTail, // Truncate at tail of line: "abcd..."
NSLineBreakByTruncatingMiddle // Truncate middle of line: "ab...yz"
} NS_ENUM_AVAILABLE(10_0, 6_0);
' ?????' 表示不理解,希望有大神为我解惑,谢谢啦!
最后,觉得有用记得给个喜欢❤️!非常感谢!