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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:12:51+00:00 2026-05-26T17:12:51+00:00

Can I have the number of rows dynamically? I’m trying to remove a tableView

  • 0

Can I have the number of rows dynamically?
I’m trying to remove a tableView section header and I don’k know how… and I’ve taught that a solution would be to change the number of sections.

Right now my numberOfSectionsInTableView looks like:

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 2;
}

and

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    beTribesAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;

    switch (section) {
        case 0:
            return [appDelegate.firstArray count];
        case 1:
            return [appDelegate.secondArray count];    
        default:
            return 0;
    }
}

setting the title section like this:

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{ 
    sectionTitles = [[NSMutableArray alloc] init];

        [sectionTitles addObject:@"firstSection"];
        [sectionTitles addObject:@"secondSection"];
    NSString *sectionText = [sectionTitles objectAtIndex:section];
    return sectionText;
}
  • 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-26T17:12:51+00:00Added an answer on May 26, 2026 at 5:12 pm

    I am not sure to understand the question as the answer seems trivial: just change the implementation to return some dynamic value and you are done, right?

    -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return self.nbSections;
    }
    

    Where nbSections is a property to which you will assign the value you want so you can change it at any time you want. So what’s the matter then?

    PS: Of course, call [tableView reloadData] to recompute the content of your tableView and make the new value being taken into account obviously… maybe that’s what you were missing?

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

Sidebar

Related Questions

I'm attempting to have a UITableView that I can dynamically add and remove rows
I have a table and can count the number of rows using var count
I have an HTML table filled with a number of rows. How can I
Trying to parse Maplines for an airport. Each airport can have X number of
I have a phone number field that can have lots of different characters such
I have simple table that has about 80 rows, which I populate dynamically using
Have JSP page with dynamically generated HTML table with unknown number of rows. Have
How can I count the table rows that is added dynamically with jQuery? I
How I can have variable number of parameters in my function in C++. Analog
Can we have same delegate for two events ? which have same number of

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.