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 6031521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:11:45+00:00 2026-05-23T05:11:45+00:00

I am trying to present a NavigationController from a regular view controller. When I

  • 0

I am trying to present a NavigationController from a regular view controller. When I present the nav controller, all I see is the default navigation bar (no matter what I set it to in IB), which makes me think the navigation controller isn’t liked right in IB. This is my code to open the navigation controller:

NavigationController *navController = [[NavigationController alloc] initWithNibName:@"NavigationController" bundle:[NSBundle mainBundle]];
[self presentModalViewController:navController animated:YES];

Here is my NavigationController header:

@interface NavigationController : UINavigationController <UINavigationControllerDelegate> {
    UINavigationController *navigationController;
}

@property (nonatomic,retain) IBOutlet UINavigationController *navigationController;

@end

And navigationController is synthesized in the implementation.

In IB, I have a navigation controller that is connected to navigationController and the file’s owner delegate. What am I doing wrong? Thanks

EDIT: This is what it looks like in IB:
IB
And this is what is looks like in the simulator:
Simulator

  • 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-23T05:11:46+00:00Added an answer on May 23, 2026 at 5:11 am

    What you currently have is a subclass of a UINavigationController. That would be what you want to do if you wanted to add custom functionality to UINavigationController (like doing a different animation between views). Since it sounds like you want to make a navigation based application, you actually just want to use the plain UINavigationController class. Here is what you what you have to do to get a UINavigationController set up with the content that you want. (I am doing this in Code because I hate having to set up UINavigationController’s in IB).

    In your applicationDidFinishLaunching, you want to add this bit of code.

    // (SomethingApplicationDelegate.m)
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      // Assume that 'window' is your main window, and 'viewController' is the property
      // that is automatically created when you do a new view controller application.
      //
      // Also, assume that 'ContentViewController' is the name of the class that display
      // the table view. This will most likely be a subclass of UITableViewController
      ContentViewController *content = [[ContentViewController alloc] init];
      UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:content];
      [viewController.view addSubview:nvc.view];
      // This is the boilerplate code that is generated when you make a new project
      self.window.rootViewController = self.viewController;
      [self.window makeKeyAndVisible];
      return YES;
    }
    

    This will create a UINavigationController and set up your table view as the content of that. When you want to do the nice animation to a new view, you do this

    // This will be inside your ContentViewController
    // Assume that 'NewViewController' is the class of the view controller you want
    // to display
    NewViewController *viewController = [[NewViewController alloc] init];
    [self.navigationController pushViewController:viewController];
    [viewController release]
    

    This will automatically do the animation to slide to the next view controller, along with making the nice back button to bring you back to your ContentViewController

    EDIT: To make the navigation controller show up as a modal view controller, this is what you do. Instead of using the above code in the application delegate, you do this.

    -(IBAction)buttonPushed:(id)sender {
      // Assume this method is in a UIViewController subclass.
      //
      // The next two lines are copied from above in the Application Delegate, the same assumptions
      // apply about ContentViewController
      ContentViewController *content = [[ContentViewController alloc] init];
      UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:content];
      // This is the magic code
      [self presentModalViewController:nvc];
    }
    

    Then, when you are done with the navigation controller, and want it to go away, you do this:

    // Assume we are in some method in ContentViewController, or a similar view controller that is showing content
    [self.navigationController dismissModalViewController];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to present a modal view controller after selecting a contact and it
I am trying to present a modal view controller. I have read the documentation,
I am trying to present a dictionary from my view.py at the HTML template
I am trying to self-destruct a view controller by doing [[self navigationController] popViewControllerAnimated:YES] .
I have a modal view controller that I am trying to present a web
I'm trying to present a view controller thats only half the height using [self
I'm trying to present a Modal View Controller when the app enters in foreground..
How can I present a modal view controller from the app delegate's view, the
I am trying to rename all the files present in a Windows directory using
I'm trying to implement a navigation controller with some hierarchical views. I want to

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.