您说您丢失了键的顺序,所以我想您从NSArray. 对?并且NSArray您可以根据需要订购钥匙。而且我还看到NSDictionaryare的对象Arrays,对吗?是的。所以在你的Ordered Array你有更多的数组。
data是 NSDictionary 的名称。
所以,你所要做的就是把它NSArray(你一直想要的那个)带入这个 .m 文件,然后在你的cellForRowAtIndexPath方法中使用一些很棒的代码。您可以通过执行以下操作来做到这一点:
@interface yourViewController ()
{
    NSArray *yourArrayOrdered;
}
@end
@implementation yourViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    yourArrayOrdered = [[NSArray alloc] initWith...:... ];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
    NSString *key = yourArrayOrdered[indexPath.row];
    NSArray *list = [self.data objectForKey:yourArrayOrdered[indexPath.row]];
    //your code continues here...
    /*id data = list[indexPath.row]; //don't think you need this line
    PSSearchCell *cell = [PSSearchCell newCellOrReuse:tableView];
    cell.model = data; */
    return cell;
}
这就是使用 NSDictionary 和 NSArray 保持想要的顺序所要做的一切。
为了更好地可视化它,如果您的有序数组仅包含字符串,它将是这样的:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath      *)indexPath
{
    NSString *key = yourArrayOrdered[indexPath.row];
    NSString *myString = [self.data objectForKey:yourArrayOrdered[indexPath.row]];
    cell.textLabel.text = [NSString stringWithFormat:@"THIS IS THE OBJECT %@", myString];
    cell.detailTextLabel.text = [NSString stringWithFormat:@"AND THIS IS THE KEY %@", key];
    return cell;
}
希望能帮助到你。