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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:35:55+00:00 2026-05-23T01:35:55+00:00

My RootViewController is a UITableViewController. A UINavigationController is added programmatically: _navigationController = [[[UINavigationController alloc]

  • 0

My RootViewController is a UITableViewController. A UINavigationController is added programmatically:

_navigationController = [[[UINavigationController alloc] initWithRootViewController:_rootViewController] autorelease];
[self.window addSubview:_navigationController.view];
[self.window makeKeyAndVisible];

Within the RootViewController.m the DetailViewController should be loaded when a row is selected:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  NSLog(@"Switch to detail");
  CCouchDBDocument *selectedObject = [self.contentsList objectAtIndex:indexPath.row];
  DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:nil];
  [self.view addSubview:detailViewController.view];
  [detailViewController setDetailItem: selectedObject]; 
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];
}

Without addSubView nothing happens on the screen. All the examples I’ve seen before only use pushViewController. And, loading the DetailView takes about 4 seconds. That’s way too long (it’s currently empty, just one label). When I try to set the navigationTitle (self.title = @”Hello”;), the title remains the same from the RootViewController, so something must be wrong with the navigationController.

I tried to put everything in the AppDelegate and use a switchView method. The problem is the call for setDetailItem, which I can’t call if I work with the switch method.

What would be the correct way to load the DetailView from the RootViewController into the navigation stack and possibly more from the DetailViewController later?

Update
I started from the beginning again with a Window-based application. Added a UITableViewController as “RootViewController” and initialised it with the UINavigationController in the AppDelegate (did absolutely nothing in the XIB). When I try to set self.navigationController.title = @”Test”; in ViewDidLoad, nothing happens.

What’s wrong there?

  • 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-23T01:35:56+00:00Added an answer on May 23, 2026 at 1:35 am

    You don’t set the title of the DetailView when it’s displayed using a UINavigationController by using self.title, you need to set the UINavigationItem title property in the DetailView initializer.

    e.g. in the DetailView initializer :-

    self.navigationItem.title = @"Hello";
    

    You’re right you shouldn’t need to add the detailViewController view as a subview of the current view – you should just need the pushViewController call. I’m not sure why it’s not appearing though.

    Obvious questions are is everything connected OK in the nib, and what does the DetailView initializer do?

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

Sidebar

Related Questions

my app looks like this UINavigationController with UITableViewcontroller as RootViewController. feedsTableViewController = [[ablogFeedsTableViewController alloc]
So I have a UINavigationController that pushes a UITableViewController from the rootViewController. From the
I have a UITableViewController, which is RootViewController. It's XIB only has a table view.
My window's rootViewController is a UINavigationController Then.. In this navigation controller's rootViewController, I popup
I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have
- (void)applicationDidFinishLaunching:(UIApplication *)application { // Create the navigation and view controllers RootViewController *rootViewController =
I was to pass a NSString from RootViewController(UITableViewController) to DetailViewController . t RootViewController.m -
Usally ,tabbar always displays buttom. like this. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window.rootViewController
I have UITableViewController as the RootViewController. I need to add rows to the table
I've got the code below in my RootViewController (which is a UITableViewController). This code

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.