要本地化我的AppDelegate我的标签栏项目我有,这样的代码:的TabBar项目定位
self.tabBarController = (UITabBarController*)self.window.rootViewController;
tabBarController.delegate = self;
tabBarController.selectedIndex = 0;
[[tabBarController.tabBar.items objectAtIndex:0] setTitle:NSLocalizedString(@"Home", nil)];
[[tabBarController.tabBar.items objectAtIndex:1] setTitle:NSLocalizedString(@"Requests", nil)];
[[tabBarController.tabBar.items objectAtIndex:2] setTitle:NSLocalizedString(@"Account", nil)];
[[tabBarController.tabBar.items objectAtIndex:3] setTitle:NSLocalizedString(@"Alarms", nil)];
[[tabBarController.tabBar.items objectAtIndex:4] setTitle:NSLocalizedString(@"Settings", nil)];
现在我已经添加了另一个项目,并试图添加具有指数= 5新线,但我得到一个“NSRangeException”,因为索引5超出了范围。 Xcode自动添加了“更多”部分,并将其中的最后两项(设置和新的)移动到那里。 我也看到,用户现在可以自定义选项卡栏选择项目的顺序。 那么现在我该如何参考所有项目并进行本地化呢? 注意:我正在使用故事板。
谢谢。
我知道Vineesh TP,这不是问题。问题是如果我添加一个新的tabbar项目与索引= 5,我得到一个NSRangeException错误。或者你的意思是我甚至不需要setTitle? – Aleph72
是否采用tabbar应用程序的权利? ,不是在应用程序代表类中给出的barbutton标题。它将不得不在你的实现类 –
中给出我知道的。我将它放在AppDelegate中,因为我们的应用程序启动后,它会检查某些内容并在某些标签栏项目上设置标记。 – Aleph72