views:

211

answers:

1

Hello,

I have a tab bar application with a different view on each tab. Each view has a UINavigationBar with title set on Interface Builder. I am wanting to change the title based on a clause in the ViewDidLoad method, so if x { change the title }.

I have tried self.title = @"title" , which I read here on Stackoverflow - but this changes the title of the tab bar item itself.

So, how is this done?

Thanks,

A: 

I've set the title programatically using code something like this:

navBar.topItem.title = @"title";

where navBar is declared as an IBOutlet UINavigationBar linked to the navigation bar in interface builder. This worked in my app; however, I was not using a tab bar.

If navBar.topItem is the tab bar item, I don't see a way for you to change the title that appears on the navigation bar without also changing the title on the tab bar item, since the navBar's topItem and the tab bar item is the same object.

GregInYEG
Worked perfectly, knew I had forgot to do something; and that was link the IBOutlet UINavigationBar to the bar itself. The title and tab text are independent of each other, btw.
AveragePro