简体   繁体   中英

Tab Bar Controller .. Item Title

i have 3 Items in my TabBar, and i will load a saved Title for this Items...

this works with this Code in ViewDidLoad..

  NSString *loadstring = [defaults objectForKey:@"char1_class"];
                NSString *charleveltitel = [defaults objectForKey:@"char1_class_level"];


                NSString *titel = [NSString stringWithFormat:@"%@ %@", loadstring, charleveltitel];
                self.navigationItem.title =  titel ;


                [[self.tabBarController.tabBar.items objectAtIndex:0] setTitle:NSLocalizedString(titel, @"comment")];

but... only when i click on the Bar Item... the code Starts in the ViewDidLoad...

i will load this for all Tabs by start the App...

Thanks Jürgen

If you are using storyboards, why not just set the title on the tab controllers in the storyboards?


or

You can also set this in your appDelegate.m file for each view controller that is in your tab controller by doing this:

[[self.tabBarController.viewControllers objectAtIndex:<index of the controller you want to change>] setTitle:@"The Title"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM