Working with UITabBarController
, I am facing the following issue.
I want to have a given string as the title for all my view controllers, in each tab. This is apparently not possible to set within the storyboard
.
By searching the net I have found this almost-working solution. Putting the following type of code in each of the separate view controllers.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UITabBarItem *tabBarItem;
tabBarItem=[[UITabBarItem alloc] initWithTitle:nil
image:[self imageFromText:@"My Tab Title"
withFont:[UIFont systemFontOfSize:17.0]] tag:0];
self.tabBarItem=tabBarItem;
}
The problem is: all the title are only set to what I want only when the user has tapped all the tabs.
This of course is not a good permanent solution. I need to have all the titles appear properly when the app starts.