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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:49:07+00:00 2026-06-10T18:49:07+00:00

I am having trouble understanding how to populate my table with all the dates.

  • 0

I am having trouble understanding how to populate my table with all the dates. returns only the day 9-1-2012 not 8-31-2012. I have tried a few things like using my days and slots in numberofrowssection. I am thinking it has something to do with .count but am not seeing where. But I have not figured it out yet. It still is only posting 9/1 dictionary. How do I display all the array of dictionaries in tableviewcell, I hope I am making sense, picture attached.
My code:

NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];

    NSDictionary* myslots =[json objectForKey:@"slots"];
    NSLog(@"allslots: %@", myslots);

    for (NSString *slotKey in myslots.allKeys) {
    NSDictionary *slot = [myslots valueForKey:slotKey];
       UPDATED:
        self.timesArray = [[NSMutableOrderedSet alloc] init];
    for (NSDictionary *myDays in slot){

        if ([[myDays objectForKey:@"isReservable"] isEqualToNumber:[NSNumber numberWithInt:1]])

           [self.timesArray addObject:[myDays objectForKey:@"begin"]];
         //NSLog(@"This is the times count: %@", timesArray.count);
    }

       NSLog(@"These are the times avail: %@", self.timesArray);          

    [self.tableView reloadData];
    }
}

Here is what that looks like:

2012-08-31 16:34:57.074 GBSB[780:15b03] These are the times avail: {(
    "2012-08-31 09:00:00 America/Los_Angeles",
    "2012-08-31 13:00:00 America/Los_Angeles",
    "2012-08-31 14:00:00 America/Los_Angeles",
    "2012-08-31 15:00:00 America/Los_Angeles",
    "2012-08-31 16:00:00 America/Los_Angeles"
)}
2012-08-31 16:34:57.074 GBSB[780:15b03] These are the times avail: {(
    "2012-09-01 09:00:00 America/Los_Angeles",
    "2012-09-01 10:00:00 America/Los_Angeles",
    "2012-09-01 11:00:00 America/Los_Angeles",
    "2012-09-01 12:00:00 America/Los_Angeles",
    "2012-09-01 13:00:00 America/Los_Angeles",
    "2012-09-01 14:00:00 America/Los_Angeles",
    "2012-09-01 15:00:00 America/Los_Angeles",
    "2012-09-01 16:00:00 America/Los_Angeles"
)}

Here is what I have tried
in .h

@property (nonatomic, retain) NSMutableOrderedSet *timesArray;

.m

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return self.timesArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    // Configure the cell...
    //cell.textLabel.text = timesArray;
    cell.textLabel.text = [self.timesArray objectAtIndex:indexPath.row];
    return cell;

Here is a pic
only displaying one dictionary

  • 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-10T18:49:08+00:00Added an answer on June 10, 2026 at 6:49 pm

    I think you are close, because your array has all of the values, just not at the same time. Try moving self.timesArray = [[NSMutableOrderedSet alloc] init]; up before the for loop so that it is only initialized once. Also, move the final NSLog and tableView reloadData down
    like this:

        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
    
        NSDictionary* myslots =[json objectForKey:@"slots"];
        self.timesArray = [[NSMutableOrderedSet alloc] init];
        NSLog(@"allslots: %@", myslots);
    
        for (NSString *slotKey in myslots.allKeys) {
            NSDictionary *slot = [myslots valueForKey:slotKey];
           UPDATED:
            for (NSDictionary *myDays in slot){
    
                if ([[myDays objectForKey:@"isReservable"] isEqualToNumber:[NSNumber numberWithInt:1]])
    
                   [self.timesArray addObject:[myDays objectForKey:@"begin"]];
                //NSLog(@"This is the times count: %@", timesArray.count);
            }
    
        }
        NSLog(@"These are the times avail: %@", self.timesArray);
        [self.tableView reloadData];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble understanding how to filter an images table by tag information in a
I am having trouble understanding how layering is performed within Xcode. I have a
from here Im having trouble understanding they say that ado.net does not include a
I'm having trouble understanding why my code will not work asynchronously. When running asynchronously
I'm having trouble understanding why I have to place the button triggering the getJSON
I'm having trouble understanding coredata with my uitableview. I have rows being deleted and
I'm having trouble understanding how to solve this issue, essentially I have two arrays
I am having trouble understanding this code. All I really need is to modify
Having trouble understanding. With the following css : .bloc .field:nth-last-child(2){ ...some values... } and
Im having trouble understanding class relationships after being asked to research it further, would

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.