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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:58:51+00:00 2026-05-21T01:58:51+00:00

I am making a new app that has four sets of data that are

  • 0

I am making a new app that has four sets of data that are very similar. I want to make four UIButtons to navigate to one UITabBar with four UITableViews. I don’t want to make four buttons that push to four sets of tableviews. I figure making an app with 13 UIViews would make it bigger than it needs to be. So, I have to figure out how to make the UIButton action change the data the tables receive. I am working on this project actively. Any suggestions would be helpful. Thank you.

  • 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-21T01:58:52+00:00Added an answer on May 21, 2026 at 1:58 am

    In order to change a table views data source you need to change what is returned from numberOfRowsInSection on your table delegate. One way I have done this is to use an enum to represent which set of data I want to use and have a local variable to save which one is selected

    typedef enum
    {
        DataSetOne,
        DataSetTwo
    } DataSetEnum
    
    @property(nonatomic, retain) DataSetEnum dataset;
    @property(nonatomic, retain) NSArray *datasetone;
    @property(nonatomic, retain) NSArray *datasettwo;
    
    - (void) viewDidLoad
    {
         dataset = DataSetOne;
    }
    - (IBAction) buttonPressed
    {
         dataset = DataSetTwo;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
         if(dataset == DataSetOne)
         {
              return [self.datasetone count];
         }
         else if(dataset == DataSetTwo)
         {
              return [self.datasettwo count];
         }
    }
    

    And then in cellForRowAtIndexPath

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
         if(dataset == DataSetOne)
         {
               //configure cell
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a c# windows app that has one MainForm and many User
I'm making a new app that has a layout as follows: LinearLayout1 LinearLayout2 Breadcrumb
I'm making a custom generator that generates a new rails app, and I do
I'm making Android app that has this database in it: public void onCreate(SQLiteDatabase db)
So I'm making an iphone app that just has a thousand entries that I'm
Okay, so i am making an android app that has tabs, now my problem
I'm using scribe for making an app that has oauth support. I didn't found
I'm creating (really, re-creating) an app that has existing user and other data in
I'm making a web application for a customer that has clients who want to
I'm making a RoR app that has 3 resources, that are nested in this

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.