我有这样一段文字:
Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World- Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World - Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World
是否有可能使用NSAttributedString
得到这样的东西:
Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World Hello World Hello World Hello World
- Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World
- Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World Hello World Hello World Hello World
对我来说,问题是在“-”之后的第二行缩进。目前我能够做到这一点:
Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World Hello World Hello World Hello World
- Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World
- Hello World Hello World Hello World Hello World Hello World Hello World
Hello World Hello World Hello World Hello World Hello World Hello World
在示例中,我为每个“-”使用了 2 行,但可能更多,或者只有一个。
我虽然使用一个UIWebView
或将文本分成不同的UITextViews
,但我觉得它有点笨拙。