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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:40:37+00:00 2026-06-09T11:40:37+00:00

I have data that is stored in a plist but when I pull it

  • 0

I have data that is stored in a plist but when I pull it to my UITableView it gets reordered for some reason. Here are my table view data source methods:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return [self.lunch_Dinner count];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return [[self.lunch_Dinner allKeys] objectAtIndex:section];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSString *typeOfEntree = [self tableView:tableView titleForHeaderInSection:section];
    return [[self.lunch_Dinner valueForKey:typeOfEntree] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"EntreeCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
    NSString *typeOfEntree = [self tableView:tableView titleForHeaderInSection:indexPath.section];
    NSString *entree = [[self.lunch_Dinner valueForKey:typeOfEntree] objectAtIndex:indexPath.row];

    cell.textLabel.text = entree;

    return cell;
}

Here is the order of the plist:

  • Appetizers
  • Soups
  • Pastas
  • Pizzas
  • Specials

And this is the resulting order in the UITableView after being compiled:

  • Pizzas
  • Soups
  • Appetizers
  • Pastas
  • Specials

Any help would be great!
Thanks in advance.

  • 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-09T11:40:39+00:00Added an answer on June 9, 2026 at 11:40 am

    If you want to store table in plist it is better to consider the following structure:

    NSArray *sections = [NSArray arrayWithObjects:
        [NSDictionary dictionaryWithObject:
            [NSArray arrayWithObjects:row_1, row_2, ... , nil] 
                forKey:@"section name 1"],
        [NSDictionary dictionaryWithObject:
            [NSArray arrayWithObjects:row_1, row_2, ... , nil] 
                forKey:@"section name 2"],
        ...
        [NSDictionary dictionaryWithObject:
            [NSArray arrayWithObjects:row_1, row_2, ... , nil] 
                forKey:@"section name N"], 
        nil];
    

    This code representation is easy to reproduce as plist. Create it as in example below

    enter image description here

    This structure can be easily used as UITableView datasource

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
        return [self.datasource count];
    }
    
    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
    {
        NSDictionary *dict = [self.datasource objectAtIndex:section];
        return [dict.allKeys lastObject];
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        NSDictionary *dict = [self.datasource objectAtIndex:section];
        return [dict.allValues.lastObject count];
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        NSDictionary *dict = [self.datasource objectAtIndex:indexPath.section];
        id cellPresenter = [dict.allValues.lastObject objectAtIndex:indexPath.row];
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data that is stored in a TIMESTAMP(6) WITH TIMEZONE column in
I have a stored procedure that logs some data, how can I call this
I have some data that is stored in a sorted vector. This vector is
I have some sensitive data that is stored in SQLite for an Android app.
I have a stored procedure that returns data in the format of: Date |
I have the following stored procedure that I have to get data from: EXECUTE
i have a stored procedure that has to retrieve data from multiple tables something
I have a SQL Server stored procedure that is not returning any data when
I have a core data context with objects that have a date stored in
I have text stored in SQL as HTML. I'm not guaranteed that this data

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.