【问题标题】:Custom bulleted text in UITextViewUITextView 中的自定义项目符号文本
【发布时间】:2016-06-01 13:15:48
【问题描述】:

我需要方形项目符号(彩色)文本如下

◼︎ Some large amount of text that    
  make it span to the next line.

显示在UITextView。但问题是它不会在下一行添加填充。

◼︎一些大量的文字
让它跨越到下一行。

这些项目符号文本是静态内容,因此无需通过代码进行设置。 当我设置属性类型时,自定义字体也不起作用。使用的自定义字体是Raleway

【问题讨论】:

  • 你可以使用NSParagraphAttributeName来处理缩进。

标签: ios uitextview nsattributedstring custom-font


【解决方案1】:

您需要设置一个带有“悬挂缩进”的尺子。我不知道如何使用文本属性手动执行此操作。

我建议改为在 .rtf 文件中设置您想要的内容,然后使用 initWithURL:options:documentAttributes:error:(仅在 iOS 9 或更高版本中可用)或 initWithData:options:documentAttributes:error:(即在 iOS >= 7.0 中可用。)

你指定一个选项字典

目标-C:

@{NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType}

斯威夫特:

[NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType]

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多