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

The Archive Base Latest Questions

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

I have an UTableView grouped. I want to split my data into categories group.

  • 0

I have an UTableView grouped. I want to split my data into “categories” group. I have an instance variable which contains all groups in my database.

@interface TableViewController : UITableViewController {

    // Response from server
    NSString* serverResponse;
    NSMutableArray *categories;     // This NSMutableArray contains all category's server    
}

@property (strong) NSString *serverResponse;
@property (strong) NSMutableArray *categories;

I fill my NSMutableArray with the requestFinished method (where all works perfectly)

- (void)requestFinished:(ASIHTTPRequest *)request
{  
    NSString *result = request.responseString;

    NSArray *jsonArray = (NSArray*)[result JSONValue];

    int count = [jsonArray count]; 
    int i;
    NSDictionary *jsonDict = [[NSDictionary alloc] init];

    for (i = 0; i < count; i++) {
        jsonDict = [jsonArray objectAtIndex:i];
        NSString *current = [jsonDict objectForKey:@"categoriy"];

        [categories addObject:current];
        NSLog(@"%d", [categories count]) // Shows 4 -> ok !
    }
}

But when I call it in this method :

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    NSLog(@"%d", [categories count])   // Show 0 -> bad !
    return [categories count];
}

It shows on the consol “0” !

I really dont understand why !

Perhaps someone could help me with this?

  • 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-03T13:53:32+00:00Added an answer on June 3, 2026 at 1:53 pm

    The problem might be that numberOfSectionsInTableView: is called before the requestFinished: is called.

    I think you have to reload the tableview.

    Try putting [self.tableView reloadData], or something like that, at the end of requestFinished:.

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

Sidebar

Related Questions

i have a grouped tableview which contains 3 sections,i want to add different buttons
I have an array of reviews which I am outputing into a grouped table.
I have a grouped UITableView with many sections, however, I want to iterate through
I have a grouped UITableView which displays a number of cells, which includes both
I have a grouped UITableView where not all sections may be displayed at once,
I have a grouped tableview with two sections, and I want the cells (in
I have a table view which is grouped according to month and year. For
I have a grouped UITableView with some sections (with an header title). I want
I have a grouped table view where I want to reload a particular row.
I have displayed the datas in grouped table view. The data's are displayed in

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.