次のように、プロパティ リストにいくつかの辞書があり、ゲームのメニュー システムを構成しています。
New game
Easy
Normal
Hard
Load game
Recent
Older
Options
Game
Sound
このリストの各項目は辞書です。
UINavigationController と UITableViews を使用して、このメニュー システムを表示します。項目が選択されると、その選択された項目の項目と共に、新しい UITableViewController が UINavigationController にプッシュされます。たとえば、最初の UITableView には、その辞書に「New Game」、「Load game」、および「Options」が含まれています。ユーザーがオプションを選択すると、項目「ゲーム」と「サウンド」(つまり、「オプション」の辞書) を含む新しい UITableViewController が作成されます。
この方法で UITableView を設定します。
- (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;
}
しかし、どうやら、それによって項目がプロパティ リストで定義されている順序と同じ順序にならないことがあります。
私がやろうとしていることをしているときに順序を維持する方法を知っている人はいますか?
ありがとう。