I have an app with a tab bar controller as the base controller. There are three tabs. Each tab has a navigation controller and then the view attached it them. I created these in the IB iPhone storyboard. I am trying to localized the app so I created the titles for each view using self.title =NSLocatizedString .... Everything works pretty well. Each view has a title, and when I change languages the correct language title shows up in the view and in the tab bar. My problem is that when I launch the app the title of the selected view shows up in the tab bar but the other two titles do not show up until I tap on the tab, then they show up. I have tried added code into my appDelegate.m but nothing has changed. Here is the code I put into my appDelegate.m. It doesn't seem to do anything because if I remove the code from my view i.e. self.title = NSLocalizedString .... the title goes away completely. So apparently the code in the appDelegate is not being called. Could someone help me.
Any help would be greatly appreciated.
I finally found the answer. In -(void) awakeFromNib I just put self.title = NSLocalizedString (@"",nil);
and it worked like a charm.
Thanks
Code:
@synthesize window = _window, tabBarController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
tabBarController = [[UITabBarController alloc] init];
MasterViewController* vc1 = [[MasterViewController alloc]init];
[vc1 setTtitle:NSLocalizedString(@"TITLE1", nil)];
SetUpTableViewController *vc2 = [[SetUpTableViewController alloc]init];
[vc2 setTitle:NSLocalizedString(@"FAMILY SET UP", nil)];
meViewController *vc3 = [[meViewController alloc]init];
[vc3 setTitle:NSLocalizedString(@"MY SET UP", nil)];
NSArray *controllers = [NSArray arrayWithObjects:vc1,vc2,vc3, nil];
tabBarController.viewControllers = controllers;
_window.rootViewController = tabBarController;
}
//I don't think this part should have anything to do with this I just have other things I do inside it.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
Any help would be greatly appreciated.
I finally found the answer. In -(void) awakeFromNib I just put self.title = NSLocalizedString (@"",nil);
and it worked like a charm.
Thanks
Last edited: