1

I'm searching for a way to display styled text in an UILabel. There are different ways to manage that:

However it seems that those possibilities do not support auto layout in the way UILabel does:

If I'm using a constraint with the visual format V:|[styledLabel] and H:|[styledLabel] (no absolute height or width is set), the label subclass (e.g. RTLabel) is not shown. If a height and a width is set, everything works fine.

Is there any way to manage styled text with using the constraints above?

Thanks in advance

4

2 回答 2

0

使用属性字符串和 UILabel,这在 Autolayout (iOS6)的同时成为可能。如果您需要将 HTML 转换为属性字符串,请尝试类似这样的操作。

于 2013-10-16T06:31:23.693 回答
0

我在使用 OHAttributedLabel 和自动布局时遇到了标签未显示的相同问题。我刚刚尝试了 TTTAttributedLabel ( https://github.com/mattt/TTTAttributedLabel ),它似乎有效。必须进行更多测试以确保一切正常......如果您也想检查它(并且仍然需要这个),请注意:)

于 2013-10-16T06:25:54.780 回答