从 Paragraph Style Types Paragraph Style Values Paragraph Style Creation Paragraph Style Access 四个方面来学习 CTParagraphStyle 样式
1.Paragraph Style Types
|
|
2.Paragraph Style Values
|
|
|
|
|
|
|
|
针对Specifier 所对应的表格
key | value | default | 解释 |
---|---|---|---|
kCTParagraphStyleSpecifierAlignment | CTTextAlignment | kCTTextAlignmentNatural | 文本对齐 |
kCTParagraphStyleSpecifierFirstLineHeadIndent | CGFloat | 0.0 | 首行缩进 |
kCTParagraphStyleSpecifierHeadIndent | CGFloat | 0.0 | 除了首行都缩进 |
kCTParagraphStyleSpecifierTailIndent | CGFloat | 0.0 | 相当文本宽度 |
kCTParagraphStyleSpecifierTabStops | CFArray of CTTextTabRef | 12 left-aligned tabs, spaced by 28.0 points | |
kCTParagraphStyleSpecifierDefaultTabInterval | CGFloat | 0.0 | |
kCTParagraphStyleSpecifierLineBreakMode | CTLineBreakMode | kCTLineBreakByWordWrapping | 换行模式 |
kCTParagraphStyleSpecifierLineHeightMultiple | CGFloat | 0.0 | 不知道杂用 |
kCTParagraphStyleSpecifierMaximumLineHeight | CGFloat | 0.0 | 最大行高 |
kCTParagraphStyleSpecifierMinimumLineHeight | CGFloat | 0.0 | 最小行高 |
kCTParagraphStyleSpecifierLineSpacing | CGFloat | 0.0 | Deprecated 废弃了 |
kCTParagraphStyleSpecifierParagraphSpacing | CGFloat | 0.0 | 段间距 |
kCTParagraphStyleSpecifierParagraphSpacingBefore | CGFloat | 0.0 | 段前距离 |
kCTParagraphStyleSpecifierBaseWritingDirection | CTWritingDirection | kCTWritingDirectionNatural | 方向(奇怪) |
kCTParagraphStyleSpecifierMaximumLineSpacing | CGFloat | 0.0 | 行最大间隔 |
kCTParagraphStyleSpecifierMinimumLineSpacing | CGFloat | 0.0 | 行最小间隔 |
kCTParagraphStyleSpecifierLineSpacingAdjustment | CGFloat | 0.0 | 废弃 |
kCTParagraphStyleSpecifierLineBoundsOptions | CTLineBoundsOptions | 0 | 不会用 |
下面是每个Specifier 对应的 效果
kCTParagraphStyleSpecifierAlignment
|
|
结果:
kCTParagraphStyleSpecifierFirstLineHeadIndent
|
|
结果: 每个段落的首行 缩进
kCTParagraphStyleSpecifierHeadIndent
|
|
结果:除了首行都缩进
|
|
kCTParagraphStyleSpecifierTailIndent
|
|
结果:相当于文本 的宽度
kCTParagraphStyleSpecifierMaximumLineHeight最小行间距
|
|
结果:
kCTParagraphStyleSpecifierMinimumLineHeight
|
|
结果
kCTParagraphStyleSpecifierParagraphSpacing 段间隔
|
|
结果:
kCTParagraphStyleSpecifierParagraphSpacingBefore 这个没看出啥,段开始部分间距。排除第一段?
kCTParagraphStyleSpecifierBaseWritingDirection 基本书写方向
kCTParagraphStyleSpecifierMinimumLineSpacing 最小行间距
|
|
效果:
3.Paragraph Style Creation
|
|
结果:
kCTParagraphStyleSpecifierLineBreakMode
|
|
结果:kCTLineBreakByWordWrapping word 换行
kCTLineBreakByCharWrapping char 字符换行
|
|
kCTLineBreakByClipping 尾部截断
kCTLineBreakByTruncatingHead 头部…
kCTLineBreakByTruncatingTail 尾部 …
kCTLineBreakByTruncatingMiddle 中间 …
|
|
4.Paragraph Style Access
|
|