NSAttributedString的单独的段落样式

时间:2018-06-27 09:19:28

标签: ios objective-c uitextview nsattributedstring nsparagraphstyle

我有可编辑的UITextViewNSAttributedString,其中包含段落和attributedText如下:

Paragraph 1
Paragraph 2
Paragraph 3
{
    NSFont = "<UICTFont: 0x7fb93e6c2f00> font-family: \"Roboto-Medium\"; font-weight: normal; font-style: normal; font-size: 25.00pt";
    NSParagraphStyle = "Alignment 4, LineSpacing 0, ParagraphSpacing 6, ParagraphSpacingBefore 6, HeadIndent 0, TailIndent 0, FirstLineHeadIndent 0, LineHeight 0/0, LineHeightMultiple 0, LineBreakMode 0, Tabs (\n    28L,\n    56L,\n    84L,\n    112L,\n    140L,\n    168L,\n    196L,\n    224L,\n    252L,\n    280L,\n    308L,\n    336L\n), DefaultTabInterval 0, Blocks (null), Lists (null), BaseWritingDirection 0, HyphenationFactor 0, TighteningForTruncation NO, HeaderLevel 0";
}

如何为每个段落获得单独的paragraphStyle? 我尝试为每个段落添加NSParagraphStyleAttributeName,但似乎NSAttributedString将具有相似段落样式的段落合并在一起。

enter image description here

我也使用了\n\r\r\n,但它们都无法提供所需的结果。

enter image description here enter image description here

0 个答案:

没有答案