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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:42:24+00:00 2026-06-06T07:42:24+00:00

I’m using XCode 4.2 and testing my build on iPad 5.0. I started building

  • 0

I’m using XCode 4.2 and testing my build on iPad 5.0.

I started building an application using the standard Tabbed application in XCode and then added code to have 2 uitableviews inside the first tab.

It compiles, but the table data does not load into the view.

App delegate.h:

@interface dmbAppDelegate : UIResponder <UIApplicationDelegate, UITabBarControllerDelegate>

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) UITabBarController *tabBarController;

@end

AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    UIViewController *viewController1 = [[[dmbFirstViewController alloc] initWithNibName:@"dmbFirstViewController" bundle:nil] autorelease];
    UIViewController *viewController2 = [[[dmbSecondViewController alloc] initWithNibName:@"dmbSecondViewController" bundle:nil] autorelease];
    self.tabBarController = [[[UITabBarController alloc] init] autorelease];
    self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];
    NSLog(@"Loading first tab view from app delegate...");
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

FirstViewController.h:

@interface dmbFirstViewController : UIViewController {

    ReservationsTable *reservationsController;
    WaitlistTable *waitlistController;
    IBOutlet UITableView *reserveTable;
    IBOutlet UITableView *waitlistTable;
}

FirstViewController.m:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    NSLog(@"FirstView Controller - View Loading Started");

    [reserveTable setDataSource:reservationsController];
    [waitlistTable setDataSource:waitlistController];

    NSLog(@"FirstView Controller - Loading Table Views..");

    [reserveTable setDelegate:reservationsController];
    [waitlistTable setDelegate:waitlistController];
    reservationsController.view = reservationsController.tableView;
    waitlistController.view = waitlistController.tableView;

    NSLog(@"FirstView Controller - View Loading Finished");
}

Both the tables have a .h and .m with the standard table methods implemented. I also added 2 tables in the first view nib file and linked them to the file owner.

Update:
ReserveTable.h:

    @interface WaitlistTable : UITableViewController <UITableViewDataSource, UITableViewDelegate>{
        NSMutableArray *waitlistitems;
    }

ReserveTable.m:

- (void)viewDidLoad
{
    NSLog(@"View Did Load - Wait List Table");
    waitlistitems = [[NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"6",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",nil] retain];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    NSLog(@"Inside number of section for Wait List table...");
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSLog(@"Inside numberofRows for Wait List table...");
    // Return the number of rows in the section.
    return [waitlistitems count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Inside cell for row at index path for Wait List table...");
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    cell.textLabel.text = [NSString stringWithFormat:@"1.%@" ,[waitlistitems objectAtIndex:indexPath.row]];    
    return cell;
}

Thoughts?

  • 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-06-06T07:42:27+00:00Added an answer on June 6, 2026 at 7:42 am

    Change your viewDidLoad to this:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
        reservationsController = [[ReservationsTable alloc] init];
        waitlistController = [[WaitlistTable alloc] init];
    
        NSLog(@"FirstView Controller - View Loading Started");
    
        [reserveTable setDataSource:reservationsController];
        [waitlistTable setDataSource:waitlistController];
    
        NSLog(@"FirstView Controller - Loading Table Views..");
    
        [reserveTable setDelegate:reservationsController];
        [waitlistTable setDelegate:waitlistController];
    
        NSLog(@"FirstView Controller - View Loading Finished");
     }
    

    basically, you are never initializing your tableViewControllers (I guess that is the name of both of them, I would change their names to something like “WaitlistTableViewController” and “ReservationsTableViewController”, but that is just me.) Also, setting the ‘tableView’ to the ‘view’ is unnecessary.

    Or even better, initialize them in the init method for your dmbFirstViewController.

    Or just use dmbFirstViewController like this:

    dmbFirstViewController.h:

    @interface dmbFirstViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
    
        ReservationsTable *reservationsController;
        WaitlistTable *waitlistController;
        IBOutlet UITableView *reserveTable;
        IBOutlet UITableView *waitlistTable;
        NSMutableArray *waitlistitems;
        NSMutableArray *reserveitems;
    }
    

    dmbFirstViewController.m:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view, typically from a nib.
    
    
        waitlistitems = [[NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"6",@"8",@"9",@"10",@"11",@"12",@"13",@"14",@"15",@"16",@"17",nil] retain];
    
        NSLog(@"FirstView Controller - View Loading Started");
    
        [reserveTable setDataSource:self];
        [waitlistTable setDataSource:self];
    
        NSLog(@"FirstView Controller - Loading Table Views..");
    
        [reserveTable setDelegate:self];
        [waitlistTable setDelegate:self];
    
        NSLog(@"FirstView Controller - View Loading Finished");
    }
    
    - (void)viewDidAppear:(BOOL)animated
    {
        [reserveTable reloadData];
        [waitlistTable reloadData];
    }
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
        // Return the number of sections.
        NSLog(@"Inside number of section for Wait List table...");
        if(tableView == waitlistTable)
        {
            //Return sections for waitlistTable
            return 1;
        }else{
            //Return sections for reservedTable
            return 1;
        }
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        if(tableView==waitlistTable)
        {
            NSLog(@"Inside numberofRows for Wait List table...");
            // Return the number of rows in waitlistTable section.
            return [waitlistitems count];
        }else{
            // Return the number of rows in reservedTable section.
            return [reserveditems count];
        }
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        if(tableView == waitlistTable)
        { 
            NSLog(@"Inside cell for row at index path for Wait List table...");
            static NSString *CellIdentifier = @"Cell";
    
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            if (cell == nil) {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
            }
    
            // Configure the cell...
            cell.textLabel.text = [NSString stringWithFormat:@"1.%@" ,[waitlistitems objectAtIndex:indexPath.row]];    
            return cell;
        } else {
            //Create cell for reservedTable Cell
            .....
            return cell;
        }
    }
    

    You’ll have to finish off the part about reservedTable cells, I didn’t have that code. Plus, I guessed on the items array for reservedTable and did not initialize it.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
Thanks in advance for your help. I have a need within an application to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.