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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:30:48+00:00 2026-05-17T23:30:48+00:00

I realize this is a popular topic, and I’ve searched through many posts here

  • 0

I realize this is a popular topic, and I’ve searched through many posts here but haven’t found anything that has helped my issue. I’m a beginner, for what it’s worth (as you’ll see by my question 🙂

My app has a tab bar with 3 items. The first loads a UINavigationController that is intended to have 3 “screens” to drill-down through (first: UITableView, second: filtered UITableView, third: UIView). I cannot, for the life of me, figure out how to show the UITableView on the 2nd screen, programmatically.

I’m overriding - (void)loadView since I’m not using IB. At different times, I’ve tried things like:

- (void)loadView
{
    [super loadView];

    // first option (thought for sure this would work)
    [[self view] addSubview:secondTableView];

    // another...
    [self tableView:secondTableView];

    // another...
    [[[[self navigationController] topLevelController] view] addSubview:secondTableController];
}

I do have the table view setup properly with it’s delegate and datasource, I just can’t figure out how to show the damn thing. The 2nd controller is also inheriting from UITableViewController. Additionally, I don’t know how you can say “fit this table view within the navigation title and the tab bar menu”. I’m using CGRectMake() currently to guess the sizes, but it seems like there should be a better way (maybe that’s why you use IB :-). Either way, that’s secondary to even getting something to show up in the first place.

Thanks in advance for any suggestions.

  • 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-17T23:30:48+00:00Added an answer on May 17, 2026 at 11:30 pm

    If you’re inheriting from UITableViewController your view should be a UITableView not a plain UIView, then when you want to create a view programmatically you should allocate it, initialize it, set its properties and assign it as your controller’s view, I haven’t tried [super loadView] before but it’s creating the tableView for you and assigning dataSource and delegate to self, so you don’t have to do that. So it should go like this

    - (void)loadView {
        UITableView *tempPointer = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) andStyle:UITableViewStylePlain];
        self.view = tempPointer;  // controller retains view property so we should release it
        [tempPointer release];
        // If you want your view to be resized automatically (to fit)
        self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        self.tableView.dataSource = self;
        self.tableView.delegate = self;
        //...
    }
    

    or

    - (void)loadView {
        [super loadView];
        self.tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        secondTableView = self.tableView; // or change your code to cope with self.tableView instead of secondTableView...
        //...
    }
    

    Clear out some uncertainties about view hierarchy creation, retaining etc in the documentation about both UIViewController and UITableViewController if you haven’t already.

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

Sidebar

Related Questions

I realize this is a basic question but I have searched online, been to
I realize this is a duplicate of about 20 different posts, but none of
I realize this is a broad topic, but I'm looking for a good primer
I realize this is dead simple but I don't write many scripts so risking
I realize this is more of a hardware question, but this is also very
I realize this is a rather odd request, but I was wondering if anyone
I realize this is probably a hopelessly newbie question, but what is the difference
I realize this sounds a little crazy, but I'm working on a project for
I realize this question is pretty basic, but I'm really stuck. I have a
I realize this question has probably been asked numerous times, but I have not

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.