LineBreakMode的错误

时间:2015-02-21 09:19:07

标签: ios objective-c uilabel nsparagraphstyle

你能解释一下为什么NSLineBreakByWordWrapping有时不起作用吗?

它的tableView

NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init];
[paragrahStyle setLineSpacing:4];
paragrahStyle.lineBreakMode = NSLineBreakByWordWrapping; //Char

[[cell titleLabel] setAttributedText:[[NSAttributedString alloc] initWithString:((Post *)posts[indexPath.section])->title attributes:@{NSParagraphStyleAttributeName : paragrahStyle, NSFontAttributeName : [UIFont fontWithName:@"Roboto-Condensed" size:24.0f]}]];

enter image description here

1 个答案:

答案 0 :(得分:0)

YES! ;)

我的格式为:

  

\ U041f \ U0438 \ U0440 \ U043e \ U0436 \ U043d \ U044b \ U0435 \ U00a0Laduree \ U00a0 \ U00ab \ U043e \ U0434 \ U0435 \ U0442 \ U044b \ U0435 \ U00bb   \ U0432 \ U00a0Emilio Pucci

其中\ U00a0是错误的空格(NO-BREAK SPACE),我编码此行并将错误的空格替换为普通空格