0

This is my first question so far so I would love some understanding!

I am localizing entire application. I have no problem with labels that while pseudolocation translate properly. However, trying to achieve the same with buttons it doesn't work.

The code is

 [self.Clear setTitle:NSLocalizedString(@"Clear",nil) forState:UIControlStateNormal];

and the .string file in en.plist content looks like this

 "Clear" = "Blah";

The pseudolocation doesn't work and I would really appreciate some help. The simulator keeps showing Clear.

If you have any questions regarding this, I will answer!

Please don't eat me :P

4

1 回答 1

0

在 Interface Builder 中,您可以设置 4 个字符串,一个用于“状态配置”下拉列表中的每个状态。

或者,或者,在代码中,您为每个状态设置按钮标题:

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:NSLocalizedString(@"21.title", @"Norm!")    forState:UIControlStateNormal];
[button setTitle:NSLocalizedString(@"21.title-highlighted", @"hi btn") forState:UIControlStateHighlighted];
[button setTitle:NSLocalizedString(@"21.title-selected", @"sel btn") forState:UIControlStateSelected];
[button setTitle:NSLocalizedString(@"21.title-disabled", @"dis btn") forState:UIControlStateDisabled];

Courtsey:本地化 IOS 按钮标签

于 2013-09-20T20:34:00.773 回答