Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set different UINavigationController titles for embedded UITabBar subviews?

In my app I have embedded a UITabBarController inside of my UINavigationController. The problem is that the UINavigationController treats that tab bar as a single view controller even though there are 4 tabs in it. I am needing to have a different header title for each of those 4 tabs that displays in the navigation bar header. Using self.title on a subclass for those 4 views does nothing. It just displays the same title in the navigation bar constantly because like I said, the UINavigationController treats that entire tab bar controller as a single view.

How can I have separate titles for each of my views that are tabs inside the tab bar controller?

like image 944
BlueBear Avatar asked Nov 22 '13 00:11

BlueBear


1 Answers

Try using [self.navigationItem setTitle:] inside each tab's view controller. If this does not work, try deeper, [self.tabBarController.navigationItem setTitle:].

like image 196
Léo Natan Avatar answered Nov 16 '22 01:11

Léo Natan