Home » Ios » UINavigationController within a UITabBarController, setting the navigation controller title

UINavigationController within a UITabBarController, setting the navigation controller title

Posted by: admin February 24, 2018 Leave a comment


In my app I have a UINavigationController within a UITabBarController. Everything is working fine, however I can’t set the title for the navigation controller. I have tried several different methods and googled around but there seems to be no solution for this problem.

Any Help would be greatly appreciated.

Thankyou in advance.



I found the answer in the end, it was:

self.tabBarController.navigationItem.title = @"title";

self.navigationItem.title = @"Your Title"

Works for every case.


For me the following works fine:

Initiate the controllers in appDelegateDidFinishLaunching:Method:

UINavigationController *navContr1;
UINavigationController *navContr2;

UIViewController *viewController1, *viewController2;

viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil] autorelease];
viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil] autorelease];

navContr1       = [[[UINavigationController alloc] initWithRootViewController:viewController1] autorelease];
navContr2       = [[[UINavigationController alloc] initWithRootViewController:viewController2] autorelease];

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
//self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:navContr1, navContr2, nil];

self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];

with this done, in your different viewControllers initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil – Method you can change the title with the following line:

self.title = @"Your Title";

Good Luck.


Look at the UIViewController class in the docs. There is a property pointing to the UINavigationItem which then has a property pointing to the title. If the pointer to the navigation item returns nil, you must have not wired the controllers together correctly.


The self.title always sets the tile of the rootViewController object of your ViewController.

If you have your viewController & the rootViewController is UINavigationController, then self.title will set the title of UINavigationController.

Similarly, if you have initialized a UITabViewController with the UIViewController objects, then the self.title will applies on the title corresponding button at index, on UITabBar of UITabViewController.

Hence said that, self.title applies on the object holding the viewController.