views:

192

answers:

1

How do I change the UITabbaritem titles when starting the App?

I got a UITabBar with 4 tabs. I want the 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?

A: 

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";
}
vodkhang
I think I understand where you are going with this. But can you be more specific? I tried to change the UITabBarItem of another view without getting a result. Where do I implement loop and do I need to change the title of the viewControllers or just the UITabBarItems? Thanks
CCDEV
In the buttonClicked: method that takes care of the event button is clicked, you put the loop. You can pass the array of UITabBarItem into the ViewController who holds the button
vodkhang
Thanks vodkhang, I will give it a go this weekend.
CCDEV