简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM