How do I change the UITabbaritem titles when starting the App?
I got a UITabBar with 4 tabs. I want the开发者_如何学Python user to be able to change between two different languages. If the user chooses a different language I need to set a different title to the UITabbaritems. I know I can use self.title = @"title";
but that only changes the current tabbaritem title. How can I change all the titles at once, on load, and when choosing a different language?
I got the same problem and solved it with.
[[self.tabBarController.viewControllers objectAtIndex:index] setTitle:@"Your title"];
Where index is your UITabBarItem index.
You need to store all your UITabBarItem into an array, when the user tap the button, you need to loop through that array and set the title.
for (UITabBarItem *item in items) {
item.title = @"WHATEVER HERE";
}
精彩评论