Is there a way to set a separate short header for a UITabBar?

I would like my views to display short names for display on the tab bar and a longer (more descriptive) name when the same view is associated with a table view. The reason is that longer names are pushed together in the tab bar. The table view has more horizontal space, so I want to use more descriptive headers there.

Typically, the title of the tab bar is set in a view controller with self.title. Is there a way to specifically set the title of the tab bar, but leave the view controller self.titlealone?

Thanks.

+5
source share
2 answers

The information displayed in the UITabBar is retrieved from each property of the UIViewController tabBarItem. Similarly, the UINavigationBar requests the location information of the UIViewController navigationItem.

Setting up two different headers will work like this (from within the UIViewController):

self.tabBarItem.title = @"TabTitle";
self.navigationItem.title = @"NavigationTitle";

You can also specify other data, such as the image of the tab bar or the title on the back button using these properties.

+9
source

Short and sweet, in your opinion, the controller viewDidLoad:

[[self tabBarItem] setTitle:@"Short Title"];
+1
source

All Articles