Xcode5 and iOS7: trailing whitespaces in strings in Localizable.strings not working anymore

后端 未结 3 842
说谎
说谎 2021-01-12 17:43

In my Localizable.strings I define a string with trailing whitespaces like this:

\"%@ points  \" = \"%@ Punkte  \";

This w

相关标签:
3条回答
  • 2021-01-12 18:15

    Have you tried the non breaking space character?

    0 讨论(0)
  • 2021-01-12 18:22

    Perhaps you can try this workaround with NSMutableAttributedString which worked for me. The "." is put in place of the whitespace.

    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)];
    
    0 讨论(0)
  • 2021-01-12 18:22

    Ok, I am solving this issue by adding the label as a subview to a view and setting the width of the label a bit smaller that that of the view.

    All styling, i.e. background image, animations etc. is done to the view, not the label. Not the KISS principle but it works.

    Thanks anyway.

    0 讨论(0)
提交回复
热议问题