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.