Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I localize my UITabBarItems?

I'm beginning to learn how to localize iOS applications and hit 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...

like image 748
Julian Avatar asked May 05 '11 23:05

Julian


People also ask

How do I localize my iOS app?

Select your root project file, and then proceed to the project panel. Find the Localization section section, click the “plus” (+) icon, and add the desired languages. Select only the Localizable. strings file for localization.

How do I add a tab bar to an item?

To add a tab, first drag a new View Controller object to the storybard. Next control-drag from the tab bar controller to new view controller and select view controllers under Relationship Segue . Your tab bar controller will update with a new tab.


1 Answers

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

- (void)awakeFromNib
{
    self.title = NSLocalizedString(@"Test", @"");
}
like image 66
Jeff Ames Avatar answered Oct 09 '22 19:10

Jeff Ames