Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8759617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:51:05+00:00 2026-06-13T14:51:05+00:00

I have been seeing this issue and resolving it by manually creating UINavigationController in

  • 0

I have been seeing this issue and resolving it by manually creating UINavigationController in the code. Could someone please tell me when I add Navigation Bar from XIB’s Attribute Inspector -> Set Top bar to Black Navigation bar, it gets displayed in the XIB but when I run the program, it doesn’t appear! I noticed that self.NavigationController was coming nil so I added UINavigationController in my XIB and assign NIB but still it’s nil! What’s wrong with this? Do I need any additional settings?

[EDIT1]

I tried adding it like below and it works but I want parent class to forward rotation and appearance events to child controller automatically. If I do following it won’t send them because I am adding nvc as child and not marketsListViewController. So I thought I have to subclass UINavigationController. See EDIT2.

self.marketsListViewController = [[MarketsListViewController alloc] initWithNibName:@"MarketsListViewController" bundle:nil];
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:self.marketsListViewController];
nvc.navigationBar.barStyle = UIBarStyleBlack;
[self.marketsListView addSubview:nvc.view];

[self addChildViewController:nvc];
[nvc didMoveToParentViewController:self];

[EDIT2]

I have subclassed marketsListViewController to UINavigationController and thought following will work but it doesn’t. It just displays navigation bar, UITableView doesn’t get displayed!

self.marketsListViewController = [[MarketsListViewController alloc] initWithNibName:@"MarketsListViewController" bundle:nil];
self.marketsListViewController.navigationBar.barStyle = UIBarStyleBlack;
[self.marketsListView addSubview:self.marketsListViewController.view];

[self addChildViewController:self.marketsListViewController];
[self.marketsListViewController didMoveToParentViewController:self];

[EDIT3]

I was wrong in Edit1 that children controller won’t get rotation events when I add child as navigation controller’s root controller. Parent still sends all the events automatically and that’s what I want! 🙂

Added navigation bar from XIB

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:51:06+00:00Added an answer on June 13, 2026 at 2:51 pm

    Could someone please tell me when I add Navigation Bar from XIB’s
    Attribute Inspector -> Set Top bar to Black Navigation bar, it gets
    displayed in the XIB but when I run the program, it doesn’t appear!

    What you see in you .xib file is just there to help you get your layout right and get a good idea of what it’ll look like. When you have an app that uses a navigation bar, the bar is almost always managed by a navigation view controller (UINavigationController). The view controllers that the navigation controller hosts don’t worry about the nav bar — their view hierarchies go in the space beneath the bar.

    So, the right way to get a navigation bar in your app is almost certainly to use a navigation controller. If you only have one view controller, make that that the navigation controller’s root view controller (note: the root view controller of the window will be the navigation view controller). You can change the appearance of the bar from your view controller by setting the navigation bar’s style:

    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    

    Update: In the code you posted, you’re just creating a new navigation controller, but not doing anything with it. I alluded above the the fact that (in most cases) the navigation controller should be the window’s root view controller. It’s fine to create your navigation controller in code, but you’ll usually do it in the app delegate, and once you create it you’ll set it as the window’s root view controller. Here’s an example borrowed from a project made fresh from Xcode’s master/detail template (sans storyboards):

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        // Override point for customization after application launch.
    
        MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MMMasterViewController" bundle:nil];
        self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
        self.window.rootViewController = self.navigationController;
        [self.window makeKeyAndVisible];
        return YES;
    }
    

    Note that after creating the window and the navigation controller, the code sets the nav controller as the window’s root view controller.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been seeing code like this usually in the start of header files:
I have been seeing this a lot lately and I am unable to find
So, I've been seeing a lot of SQL examples on this site. I have
I have been seeing this error for the past couple of days. I am
I am new to AJAX and have this issue. I am creating a photogallery
Q1: Is there something like too much ajax?? Explanation: I have been seeing programmers
Have been working on this question for a couple hours and have come close
We've been seeing this problem for a while now and I'm really trying to
So I've been seeing this crash pretty frequently in Crashlytics, both on iPad and
I have been seeing a weird lag in the text that is input into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.