Is there a way to set a separate short title for UITabBar?
cocoa-touch, iphone, objective-c, uitabbarcontroller
Solution
The information that is displayed in a UITabBar is queried from each UIViewController's tabBarItem" property. Similarly, a UINavigationBar queries the UIViewController's navigationItem for information.
Setting two different titles would work like this (from within you UIViewController):
self.tabBarItem.title = @"TabTitle";
self.navigationItem.title = @"NavigationTitle";
You can also specify other details like the tab bar image or the title on the "back button" via these properties.
Problem
I'd like to be able to give my views short names for display on the tab bar, and longer (more descriptive) name when the same view is linked to in a table view. The reason is that longer names nudge up against each other on the tab bar. In a table view, there's more horizontal space, so I want to use more descriptive titles there. Normally, the tab bar's title is set in its view controller with `self.title`. Is there a way to specifically set the tab bar title, but leave the view controller's `self.title` alone? Thanks.