Xcode5和iOS7:Localizable.strings中字符串中的尾随空格不再起作用

Ric*_*d R 6 string whitespace trailing ios7 xcode5

在我的Localizable.strings中,我定义了一个带有尾随空格的字符串,如下所示:

"%@ points  " = "%@ Punkte  ";
Run Code Online (Sandbox Code Playgroud)

这在iOS6中运行得很好但是当在iOS7模拟器上运行时,字符串被修剪并且尾随的空格被剥离.

背景:上面的字符串在标签中右对齐.我使用空格作为填充,因为我不想为UILabel创建子类或只为一个标签编写一堆代码.

我也尝试过使用ASCII标志,但这也行不通.

任何关于简单灵魂的建议都将受到赞赏.

谢谢!

use*_*227 8

也许你可以尝试使用NSMutableAttributedString来解决这个问题."." 代替空白.

NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%i.", count]];


 [string addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0,string.length-1)];

 [string addAttribute:NSForegroundColorAttributeName value:[UIColor clearColor] range:NSMakeRange(string.length-1,1)];
Run Code Online (Sandbox Code Playgroud)