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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:18:02+00:00 2026-06-09T05:18:02+00:00

In my iPad app storyboard design, there are two table views added. One table

  • 0

In my iPad app storyboard design, there are two table views added.

One table view is for displaying the folder names and the other table view is for displaying the file names. When ever a folder table view cell is selected the files inside the selected folder needs to to be displayed in the other table view(the files table view).

My problem is

I am confused about

  • How to add delegate and data source for each table view in ViewController ? or is it possible to add data source and delegates for each table view in a custom class other than ViewController ?

and

  • How to handle the selection of cell ?

Please help !

  • 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-09T05:18:04+00:00Added an answer on June 9, 2026 at 5:18 am

    First off: Why don’t you just display the files on a pushed viewController which takes up the whole screen? Seems more intuitive for me.

    If you want to do it with two tableViews, and assuming they use dynamic cells than:
    1, In the .h file of your view controller

    specify two tableView properties like so:

    @property (weak, nonatomic) IBOutlet UITableView *foldersTableView;
    @property (weak, nonatomic) IBOutlet UITableView *filesTableView;
    

    implement the two delegate protocols of the UITableVIew

    @interface ViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> 
    

    2, Add the two UITableViews onto your ViewController, and…

    • …link your Outlets to the two tableviews
    • …on the attributes inspector set the Tag of the foldersTableView to 1 and the filesTableView to 2
    • …select each of the UITableViews, go to the Connections Inspector and link their two delegate methods (delegate and datasource) to your ViewController (for both of them)

    3, In the .m file of your ViewController implement the three datasource methods of UITableView like so:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
        // Return the number of sections.
        if (tableView.tag == 1) {
           return theNumberOfSectionsYouWantForTheFolderTableView;
        } else {
           return theNumberOfSectionsYouWantForTheFilesTableView;
        }
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        // Return the number of rows in the section.
        if (tableView.tag == 1) {
           return [foldersArray count];
        } else {
           return [filesArray count];
        }
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
            if (tableView.tag == 1) {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
        // Configure the cell...
        return cell;
    
    } else {
        static NSString *CellIdentifier = @"Cell";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
        // Configure the cell...
    
        return cell;
    }
    }
    

    4, Implement the selection:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (tableView.tag == 1) {
            //fill filesArray with the objects you want to display in the filesTableView...
            [filesTableView reloaddata];
        } else {
            //do something with the selected file
        }
    }
    

    Hope I got everything correctly. Don’t forget to @synthesize the properties in the .m file if you are using pre XCode 4.4.

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

Sidebar

Related Questions

I am Started my iPad app using View-Based application. in first two views i
I have this iPad app using Storyboard. There are some file that are marked
This is an iPad app. You press one of two buttons and it presents
I am developing an ipad app.In this app,I have two sections-one showing a Gallery
I created an app for iPad (not using StoryBoards), with a UITabBarController. I added
I made ​​an app for iPhone and iPad with storyboard.Let me know if you
I have an iPad app that uses the storyboard board feature and then I
I'm writing an iPad app and I have a custom view where I override
In the Comcast Xfinity iPad app, there is a small button called Filter by
Can you make a universal app with storyboards without the ipad storyboard file, just

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.