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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:11:27+00:00 2026-05-18T20:11:27+00:00

Im having a little issue with using more than 1 UITableView on a view.

  • 0

Im having a little issue with using more than 1 UITableView on a view.

Here’s what I’ve done so far (using examples, etc from here and other places):

Created a class for each table. Each class is pretty basic:

.h:

@interface ConstructionDocumentsJobTable : UITableViewController <UITableViewDataSource, UITableViewDelegate> {
    NSMutableArray  *tableItems;
    IBOutlet UITableView *itemsTable;
    NSInteger recordSelected;

    id <JobTableSelectionDelegate> tableSelectDelegate;
}

@property (nonatomic, retain) NSMutableArray *tableItems;
@property (nonatomic, assign) id <JobTableSelectionDelegate> tableSelectDelegate;

@end

.m:

@implementation ConstructionDocumentsJobTable
@synthesize tableItems, tableSelectDelegate;

#pragma mark - 
#pragma mark View Life Cycle
-(void) loadView
{

}

-(void) dealloc
{
    [tableItems release];
    [super dealloc];
}

#pragma mark -
#pragma mark Table view data source

// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [tableItems count];
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

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

    cell.textLabel.text = [tableItems objectAtIndex:indexPath.row];

    return cell;
}

#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    //pass the tap value back to the delegate
}

Both are completely identical, save the names.

When Im making the call to the first one, it is called in the ViewDidLoad method of the controller of the view. It’s pretty basic:

NSMutableArray *tableItems = [[NSMutableArray alloc] initWithCapacity:intMax];

//strDocumentType is set elsewhere and loaded here
if(strDocumentType == @"typea"){
    [tableItems addObject:@"Type A - Value 1"];
    [tableItems addObject:@"Type A - Value 2"];
}
else {
    [tableItems addObject:@"Type B - Value 1"];
}

if(jobTableController == nil){
    jobTableController = [[ConstructionDocumentsJobTable alloc] init];
    [jobTableController loadView];
    jobTableController.tableItems = tableItems;
    jobTableController.tableSelectDelegate = self;
}

[tableJobList setDataSource:jobTableController];
[tableJobList setDelegate:jobTableController];    
jobTableController.view = jobTableController.tableView;

The second table is built when a cell in the first table is selected. So, in the first tables selection method, the delegate is called back from the parent controller, which then has this:

NSMutableArray *tableTypeItems = [[NSMutableArray alloc] initWithCapacity:100];

if(tableSelect == @"plumbing"){
    [tableTypeItems addObject:@"Something"];
    [tableTypeItems addObject:@"Other"];
}

if(typeTableController == nil){
    typeTableController = [[ConstructionDocumentsTypeTable alloc] init];
    [typeTableController loadView];
    typeTableController.tableItems = tableTypeItems;
    typeTableController.tableSelectDelegate = self;
}

[tableTypeList setDataSource:typeTableController];   
[tableTypeList setDelegate:typeTableController];
typeTableController.view = typeTableController.tableView;
[typeTableController.tableView reloadData];

//Code to move the first table off the screen and move this one into view goes here

Ive been stuck on this for days, and I really need to get this done!!!

Im sure it’s something REALLLLLLY simple.

Any help you guys can pass along would be HUGELY appreciated.

Thanks everyone.

  • 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-18T20:11:28+00:00Added an answer on May 18, 2026 at 8:11 pm

    Your only defining itemsTable in your header, try defining another table, and in your cellForRowAtIndexPath try this:

    if(itemsTable1){
        /* stuff for first table  */
    } else {
        /* stuff for second table  */
    }
    

    And do the same for each UITableVIew Delegate

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

Sidebar

Related Questions

Im having a little issue with using more than 1 UITableView on a view.
i'm having a little issue with doctrine using symfony 1.4 (I think it's using
I'm having a little issue with the colorbox when using it in a facebook
I'm having a little issue with getting a value of field in HTML using
Hopefully someone can shed a little light on an issue that I'm currently having
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to
having a little architectural trouble here. In C++, we have the notion of 'friends,'
I've been having a little issue with image URLs. Usually I wouldn't care about
I'm having a little bit of trouble understanding what the problem is here. I
I'm having this little issue : each time my code executes the InsertOrder() routine

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.