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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:37:05+00:00 2026-06-14T13:37:05+00:00

I have an NSDictionary received from a json request that looks like this: RESULT

  • 0

I have an NSDictionary received from a json request that looks like this:

RESULT : (
    {
    Id1 = 138;
    lat = "45.5292910";
    long = "-73.6241500";
    order = "2343YY3"

},
    {
    Id1 = 137;
    lat = "45.5292910";
    long = "-73.6241500";
    order = "2343YY3"

}, etc.

I want to display it in a TableView (CellforRowAtIndexPath), so I obtain the data as NSArray. The method seems inefficient as each key Id1, lat, long, etc is created as an NSArray so that I can display them each with: [self.data1 objectAtIndex:indexPath.row]; [self.data2 objectAtIndex:indexPath.row], etc.

How can I achieve the same thing without creating and using 4 NSArrays? Can I use a single NSArray or the NSMutableDictionary which stores the data?

UPDATED:

When the TableView loads, it is initially empty but I have a button on that same VC that loads a modal view of a form. When I load the form and then dismiss it returning to the TableView, the data is LOADED! Could you suggest what I am missing?

  • 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-14T13:37:06+00:00Added an answer on June 14, 2026 at 1:37 pm

    Yes you can use a single array. The trick is to create an array with each array entry holding a dictionary. Then you query the array to populate your tableview.

    E.g.: If your array is a property called tableData and you have custom tableview cell called CustomCell then your code might look something like the following:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        // Return the number of sections.
        return 1;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        // Return the number of rows in the section.
        return [self.tableData count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *CellIdentifier = @"CustomCell";
    
        CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        // Configure the cell...
        cell.latitude.text = [[self.tableData objectAtIndex:indexPath.row] objectForKey: @"lat"];
        cell.longitude.text = [[self.tableData objectAtIndex:indexPath.row] objectForKey:@"long"];
        // continue configuration etc..
        return cell;
    }
    

    Similarly, if you have multiple sections in your tableview then you will construct an array of arrays, with each sub-array containing the dictionaries for that section. The code to populate the tableview would look something similar to the following:

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        // Return the number of sections.
        return [self.tableData count];
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        // Return the number of rows in the section.
        return [[self.tableData objectAtIndex:section] count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *CellIdentifier = @"CustomCell";
    
        CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        // Configure the cell...
        cell.latitude.text = [[[self.tableData objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey: @"lat"];
        cell.longitude.text = [[[self.tableData objectAtIndex:indexPath.section] objectAtIndex:indexPath.row] objectForKey:@"long"];
        // continue configuration etc..
        return cell;
    }
    

    TL;DR; Take your dictionaries created from your JSON data and put them in an array. Then query the array to populate the tableview.

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

Sidebar

Related Questions

the question explains it all. For instance, if I have a NSDictionary like this
I have a simple NSDictionary that I am trying to populate with data from
I have a app that receive a feed from a server through json. I
i have a NSDictionary which looks like: { Item1 = 2.4; Item2 = 5.5;
I have a NSDictionary, which looks like: 0 = { content = Test; date
I have a sample app that looks like a social network iOS app. I
i have a NSDictionary of this type : ********** = ( 20110330 7Huge Sandstorm
I have an NSDictionary that holds all the data: One title (not important for
I have this NSDictionary: Categorys = { Category = ( { categoryDescription = {
I have to make below NSDictionary {aps:{sound:default, alert:{body:From Franklin Av To Grand Army Plaza03:56:30

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.