4
在我找到的教程中使用NSDictionary的Im,但我只是有一個簡單的問題,爲什麼它按字母順序排序?爲什麼我的NSDictionary鍵按字母順序排序
NSArray *array = [[NSArray alloc] initWithObjects:userName, nil];
NSArray *array2 = [[NSArray alloc] initWithObjects:@"Other Data", @"Second Entry", nil];
NSDictionary *temp =[[NSDictionary alloc] initWithObjectsAndKeys:array, @"Name", array2, @"A",nil];
self.sortedKeys =[[temp allKeys] sortedArrayUsingSelector:@selector(compare:)];
感謝您的幫助。
如果我只是想讓他們按照輸入排序我怎麼能這樣做? – 2011-02-28 19:58:04
有沒有辦法使標準的'NSDictionary'保持鍵的順序,看到這[相關問題](http://stackoverflow.com/questions/376090)。 – zoul 2011-02-28 21:00:14