开发者

How can I localize my UITabBarItems?

I'm beginning to learn how to localize iOS applications and hit开发者_如何学JAVA a wall while trying to localize my UITabBarItems.

Note that these were created in interface builder (using XCode 4).

Is there a way to do this or would I need to create the UITabBarController using just code and manually inserting a localized string for each UITabBarItem?

Cheers

PS:

I do know that I can set the tile of a UITabBarItem by setting the view controller's title like so:

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = NSLocalizedString(@"Test", @"");
}

... but this only woks once you hit the tab bar item. Before that it just shows what you put in interface builder...


It seems to work if you set title in awakeFromNib instead:

- (void)awakeFromNib
{
    self.title = NSLocalizedString(@"Test", @"");
}


On Swift 3 and 4:

override func awakeFromNib() {
    super.awakeFromNib()

    self.title = NSLocalizedString("Test", comment: "")
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜