tcurdt
tcurdt

Reputation: 15808

UINavigationBar and UINavigationItem but no title

I've got a UITabController. One of the tabs is a UINavigationController. Pushing and popping the navigation stack works just fine. Every UIViewController has his own NIB with just the UIView hooked up. But unfortunately I only get a title displayed for the root navigation controller!

Usually when creating a UIViewController in a NIB you have a title attribute that you can set. But in this case the view controller is the NIB file owner. And in IB there is no way to set the title.

What I can do is to set the title in initWithNib and then it shows up.

if (self = [super initWithNibName: @"MyViewController" bundle:nil]) {
    self.title = @"test";
}

But I want to define the title in IB.

I am a bit lost here. Any suggestions?

Upvotes: 0

Views: 2628

Answers (2)

tcurdt
tcurdt

Reputation: 15808

So apparently their is no way to set the title of the UIViewController in this scenario. Too bad.

Upvotes: 0

h4xxr
h4xxr

Reputation: 11475

This is indeed all possible in IB.

You need to load up the NIB file with the UITabController in it. Then, set the View Mode (set of 3 icons at top left) to the middle option. This shows all the components as a nested tree.

Then select the View Controller in question, and bring up the Attributes Inspector. There you will see that you can change the title.

Have included a screenshot so you can see what I mean...

alt text http://img7.imageshack.us/img7/1875/screenshot20090903at120.png

Upvotes: 1

Related Questions