r0ddy
r0ddy

Reputation: 183

Trouble updating UINavigationController's Title

I have a UINavigationController with a UIViewController as the RootViewController.

The view controller cycles through 3 different view controllers (screen) depending on a popover selected. The cycling is working fine. Now I know that the Nav Controller is supposed to update it's title based on the title attribute being set for it's current controller on the stack, but I'm thinking because of how I've got it set up this could be the cause of my issues.

But I don't know how to get around it. I've a few different things but this seemed most correct:

iNephroCareAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.navController.navigationItem.title = @"Test Title";

I'm trying to set this from one of the view controllers (screens).

Still, nothing. Anyone have any ideas? Help much appreciated.

Upvotes: 0

Views: 98

Answers (1)

cocoakomali
cocoakomali

Reputation: 1356

If every view controller is pushed rather than adding it's view as subview, then you can use the below line of code in viewDidLoad or viewWillAppear of all view controllers

self.title = @"Navigation title";

Upvotes: 3

Related Questions