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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:47:55+00:00 2026-05-25T16:47:55+00:00

In viewDidLoad I add a tableview to navigationController like this : [self.view addSubview:navigationController.view]; [self.navigationController.view

  • 0

In viewDidLoad I add a tableview to navigationController like this :

[self.view addSubview:navigationController.view];
    [self.navigationController.view addSubview:tableViewRecherchePartenaire];

When a row from tableview is selected I want this tableview to disappear and I tried something like this :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
 if(indexPath.row==0){
        NSLog(@"RecherchePartenaireTypePartenaireViewController...");


        [self.navigationController.view removeFromSuperview];

        recherchePartenaireTypePartenaireViewController=[[RecherchePartenaireTypePartenaireViewController alloc] init];
        recherchePartenaireTypePartenaireViewController.recherchePartenaireViewController=self.view;

        [self.navigationController pushViewController:recherchePartenaireTypePartenaireViewController animated:YES];
        [recherchePartenaireTypePartenaireViewController release];
    }
} 

but the tableview disappear but the next view is not appear. How can I use the table view with the navigationController ? Please help…I spent a lot of time with this and I can see the mistake..Thanks in advance..

  • 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-25T16:47:55+00:00Added an answer on May 25, 2026 at 4:47 pm

    First of all, you must not add subview to UINavigationController‘s view. Put your UITableView in a subclass of UIViewController and make it the rootViewController of your navigationController. You can do it in your main xib file or programmatically :

    navigationController.rootViewController = myTableViewController;
    

    After you can almost keep your function :

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        if(indexPath.row==0){
            NSLog(@"RecherchePartenaireTypePartenaireViewController...");
            recherchePartenaireTypePartenaireViewController=[[RecherchePartenaireTypePartenaireViewController alloc] init];
                        [self.navigationController pushViewController:recherchePartenaireTypePartenaireViewController animated:YES];
            [recherchePartenaireTypePartenaireViewController release];
        }
    } 
    

    But this function will be in myTableViewController.

    In your code, you were removing your navigationController’s view from the view hierarchy. So it’s normal that nothing came up when you were pushing something, because UINavigationController handle push by pushing the next controller’s view on it’s own view.

    Here is a nice Apple’s sample that could help you 🙂
    http://developer.apple.com/library/ios/#samplecode/TheElements/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007419

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

Sidebar

Related Questions

In my view controller's -viewDidLoad method, I call [myTextField becomeFirstResponder]; This works like a
- (void)viewDidLoad { [super viewDidLoad]; [self.tableView setRowHeight:100]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; [self.view setBackgroundColor:[UIColor groupTableViewBackgroundColor]]; } #pragma
Anyone know why this root View Controller's viewDidLoad is being called twice at launch?
I have this code to set the background image of the UITableViewController: self.tableView.backgroundColor =
The SimpleEKDemo sample has a [self.tableView reloadData] at the end of viewDidLoad in the
i want to add a row in a table on the click event of
I'm trying to add a custom view to an UITableView created with code from
there is a method called viewDidLoad that execute a code when the view is
This is my program - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line
I have created several UI elements in the viewDidLoad method. I want to change

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.