【发布时间】:2017-01-31 10:30:49
【问题描述】:
我的 UILabel 有一个很长的文本(不同情况和语言的文本不同,我使用 AttributedString),它以数量结尾。喜欢:
This amount will be taken from your account: 12.00 $
标签的 numberOfLines = 0,所以有时文本看起来像
This amount will be taken from your account: 12.00
$
不要在 12.00 和 $ 之间设置换行符非常重要,因为它看起来很糟糕。有没有什么特殊符号像
  在 html 中,所以我可以把它放在 12.00 和 $ 之间?所以 UILabel 从来没有在 12 和 $ 之间设置过中断?
所以我想要的是:
This amount will be taken from your account:
12.00 $
或
This amount will be taken from your account: 12.00 $
或
This amount will be taken from
your account: 12.00 $
但它不应该是这样的
This amount will be taken from your account: 12.00
$
【问题讨论】:
-
我不认为这实际上是重复的,因为在这种情况下,用不间断空格替换空格的通用解决方案不是最佳的。
标签: ios swift nsstring uilabel nsattributedstring