【问题标题】:How can I line break OHAttributedLabel如何换行 OHAttributedLabel
【发布时间】:2012-06-19 11:31:04
【问题描述】:

如何换行OHAttributedLabel?我下面的代码不起作用。

OHAttributedLabel *lbl = [[OHAttributedLabel alloc] init];
lbl.lineBreakMode = UILineBreakModeTailTruncation;

【问题讨论】:

    标签: iphone objective-c ios cocoa-touch nsattributedstring


    【解决方案1】:

    将标准换行符(\n、\r、\r\n、Unicode 段落分隔符)附加到属性文本属性应该可以解决问题。

    【讨论】:

    • 文本事先不知道,我不知道把Unicode段落分隔符放在哪里,为此我需要使用属性lineBreakMode
    • 在这种情况下,从文档中 UILineBreakModeTailTruncation 将在溢出时截断文本,而您要使用的是 UILineBreakModeWordWrap。
    • 奇怪,UILabel 的文档说UILineBreakModeWordWrap 是默认值,但这对我也有用。也许OHAttributedLabel 使用不同的默认值。
    猜你喜欢
    • 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
    相关资源
    最近更新 更多