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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:29:53+00:00 2026-06-03T11:29:53+00:00

I have a tableview where i return the no of sections and no of

  • 0

I have a tableview where i return the no of sections and no of rows for each sections dynamically. I can implement it like this

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(  section == 0)
    return [array count];

    if(  section == 1)
    return [array2 count];

    if(  section == 2)
    return [array3 count];
}

if i am aware that i have 3 sections i can do it in this above mentioned way. But how to dynamically define the no of rows for different sections. e.g:- u have if(section == 0). i dont want to hard code the value of 0,1,2 here. I am not sure about the total no of sections. How can we do it we want to return the no of rows dynamically for different sections? I have an array to display no of sections and different arrays to display no of rows for each section. How to dynamically mention in the method “numberOfRowsInSection”?

  • 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-03T11:29:58+00:00Added an answer on June 3, 2026 at 11:29 am

    here you can follow this approach , you can put all your countable arrays in another NSMutableArray like lets say tmpArray (e.g. tmpArray[0] = array or tmpArray[1] = array2 , or just by appending [tmpArray addObject:array] ..),

    then you can go like this

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
    {
        return [[tmpArray objectAtIndex:section] count];
    }
    

    i hope this will help you to solve your problem ..

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

Sidebar

Related Questions

I have a table view with sections. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return numberHigherThen0; }
Can I have the number of rows dynamically? I'm trying to remove a tableView
I have a tableview with four sections first section has 7 rows in that
I have some problems with UITableView and sections/rows. Iam parsing the section names, all
I have a UITableView with 2 sections. The section 0 contains a list of
So I have my UITableView, with 2 sections and 1 cell in each, and
I have a UITableView that should have 33 rows. Each row represents a specific
I have created a UITableView with 4 Sections and 3 Rows so totally 12
I have set up a UITableView which has 3 sections in, with 3 rows
So I have this code to delete a row in my tableview: - (void)tableView:(UITableView

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.