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

  • SEARCH
  • Home
  • 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 6098011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:06:30+00:00 2026-05-23T13:06:30+00:00

There’s something fundamental that I’m not understanding about presenting views that get their interface

  • 0

There’s something fundamental that I’m not understanding about presenting views that get their interface from a XIB file.

My app’s root view controller is a UITabBarController. One of the tab bar options presents a UINavigationController-controlled view. One the navigation bar of that view, I have a plus (+) button for adding a new item. I want to present the AddItem view as a modal view, and it should take its interface from the AddItemView.xib file. That XIB file has in it a Navigation Controller.

However, the navigation bar doesn’t appear. Here’s the function that gets called when clicking on that plus button:

- (void)showNewView:(UIViewController *)viewController
{
    AddItemViewController *vc = [[AddItemViewController alloc] initWithNibName:@"AddItemViewController" bundle:nil];

//viewController is the UIViewController on which the plus button was tapped
    [viewController.navigationController presentModalViewController:vc animated:NO];
}

All I get is a white screen. Do I need to do something in viewDidLoad for AddItemViewController? Do I need to connect something to the UINavigationController instance in the XIB?

All this seems to just work with the tab bar, which is in the MainWindow.xib file. The UITabBarController there has a UINavigationController under it, which in turn has a subclass of UITableViewController under it, and that in turn contains the UITableView that is the initial content you see on the screen when tapping on the corresponding option in the tab bar. So I’m not sure why just sticking those things in IB doesn’t cause the same to happen.

As I said in the beginning, I’m sure this problem stems from a fundamental misunderstanding about the relationship between XIB files, their view controllers, and the view controllers that call upon them. So while I do want to get this particular issue solved, I’d love an answer that can address this broader misunderstanding.

  • 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-05-23T13:06:30+00:00Added an answer on May 23, 2026 at 1:06 pm

    The view controller that you’re presenting is vc, which is an AddItemViewController. It’s not enough that there’s a navigation controller in the .xib file — you have to actually use it. 😉

    Check out Listing 6-1 in Presenting a View Controller Modally for an example of one way to do what you want. If you want to use the nav controller that’s already in your .xib, then make an outlet for it and present it rather than the AddItemViewController that you’re currently presenting.

    All this seems to just work with the
    tab bar, which is in the
    MainWindow.xib file. The
    UITabBarController there has a
    UINavigationController under it, which
    in turn has a subclass of
    UITableViewController under it, and
    that in turn contains the UITableView
    that is the initial content…

    All those objects in MainWindow.xib are loaded at the same time and already connected to each other. But you don’t have the tab bar connected directly to the table view controller, right? You have it connected to the navigation controller. When the corresponding tab is tapped, the tab bar controller doesn’t know a thing about the table view controller — it just asks that nav controller for its view, and the navigation controller then asks the table view controller for its view, layers that with the navigation views (see Anatomy of a Navigation Interface) and returns the result to the tab bar controller.

    Imagine what would happen if you did connect the tab bar controller directly to the table view controller. This time, the tab bar controller would be talking to the table view controller directly, so when it asks that tab’s view controller for its view, all it gets back is the table view controller’s view, i.e. the table, with no navigation features.

    The same thing is happening with your modal view controller. Since you’re presenting the AddItemViewController and not the navigation controller, the AddItemViewController is all you get.

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

Sidebar

Related Questions

There is one method in Lookup<,> that is not in ILookup<,> : public IEnumerable<TResult>
There is a conversion process that is needed when migrating Visual Studio 2005 web
There are a few ways to get class-like behavior in javascript, the most common
There is a field in my company's Contacts table. In that table, there is
I have text I am displaying in SIlverlight that is coming from a CMS
There's http://www.amazon.com/gp/product/0321278542/ but it looks a bit dated. Specificaly, it talks about bits that
There is any syntax to use something like this?: <?php function get_foo() { return
There is something strange going on. I am using Zend Framework on a subfolder
There is no problem to get the src or alt separately,but how can get
There is a statement in the foudations of Qt Development book that goes as

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.