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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:19:35+00:00 2026-05-13T16:19:35+00:00

I’ve got a couple dictionaries in a property list, that make up a menu

  • 0

I’ve got a couple dictionaries in a property list, that make up a menu system for my game, like so:

New game
    Easy
    Normal
    Hard
Load game
    Recent
    Older
Options
    Game
    Sound

etc.. Each item in this list is a dictionary.

I use UINavigationController and UITableViews to display this menu system. When an item is chosen, a new UITableViewController is pushed in the UINavigationController, together with the items of that chosen item. For exmaple, the first UITableView contain “New Game”, “Load game”, and “Options” in its dictionary. If the user selects options, a new UITableViewController is created with the items “Game” and “Sound” (i.e. the dictionary of “Options”).

I populate the UITableView in this way:

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        cell = [[[UITableViewCell alloc] init] autorelease];
    }

    // Set up the cell...

    cell.text = [[[data keyEnumerator] allObjects] objectAtIndex:indexPath.row];

    // Data is the dictionary..

    return cell;
}

But apparently, that causes the items to not come in the same order as they are defined in the property list.

Does anyone know how to preserve the order when doing what I’m trying to do?

Thanks.

  • 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-05-13T16:19:35+00:00Added an answer on May 13, 2026 at 4:19 pm

    Dictionaries never preserve order. You’ll need to use an Array. You can either use an array instead (I don’t see any reason why you would need a dictionary from your example), or you can create an array that indexes the dictionary.

    So, start with the dictionary you have now, create an array, loop through the dictionary and set the array values to the keys in the dictionary.

    So if your dictionary looked like this

    Game Types
        easy: Easy
        normal: Normal
        hard: Hard
    

    Your array would look like this: [“easy”, “normal”, “hard”] (none of this is objective c code). You could then use the following line.

    [myDictionary objectForKey:[myArray objectAtIndex: indexPath.row]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.