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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:52:08+00:00 2026-05-26T00:52:08+00:00

I have an app where I need to have two tableviews swapped in and

  • 0

I have an app where I need to have two tableviews swapped in and out by once view controller. I currently have it set so the viewcontroller is the delegate and datasource to both, so I use if / else statements in the delegate / datasource methods to determine which tableview to perform the action on like below:

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    if (tableView == [self selectAnAlbumTableView])
    {
        return [[self albums] count];
    }
    else
    {
        return ceil([[self album] numberOfAssets] / 4.0);
    }

}

However, I saw this in another thread: “One method which I have often used is to actually have the delegates and data source for the two UITableViews be different objects. This way, your view controller doesn’t have to switch back and forth, and your code is overall cleaner and simpler.” My question is, how would you go about implementing something like this, ie separate objects for the delegate / datasource, and is it better than what I’m currently doing?

  • 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-26T00:52:09+00:00Added an answer on May 26, 2026 at 12:52 am

    See at most elementary level: I would recommend you not to play with two table view controllers .Just use a navigatorcontroller and push a view based on your requirement. Its much easier to call you different view controller classes than play with two table views in same controller.

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

Sidebar

Related Questions

In my app I have a need to load the same view from two
I have a Navigation Controller with two Views. The First View is a ViewController
I'm building an Android app and I need to have two different themes for
In my app I have need to trigger show some custom view when status
I have a app that shows two polygons. I need to make progressively invisible
I have an app delegate, whose default view should be preceeded by a modal
So, I'm developing an app and need to have two buttons pressed at the
I have an iphone app. The view is consists of two children: a tableview
I have two possible URL-s in my web app. www.domain.com www.user.domain.com Now I need
I currently have an app which is set to support Android 2.2 and have

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.