私は次のような内容の説明NSMutableArray
を持っています:NSURLConnection
array {
"<NSURLConnection: 0x60eb40>",
"<NSURLConnection: 0x6030e0>",
"<NSURLConnection: 0x602ce0>",
"<NSURLConnection: 0x60c330>",
"<NSURLConnection: 0x662f5a0>",
}
私はまた、NSMutableDictionary
そのキーが上記のアイテムであるように持っていますNSMutableArray
:
dictionary {
"<NSURLConnection: 0x602ce0>" = "Last update: Sep 3, 2012";
"<NSURLConnection: 0x6030e0>" = "Last update: Sep 7, 2012";
"<NSURLConnection: 0x60c330>" = "Last update: Sep 4, 2012";
"<NSURLConnection: 0x60eb40>" = "Last update: Sep 6, 2012";
"<NSURLConnection: 0x662f5a0>" = "Last update: Sep 5, 2012";
}
NSMutableDictionary
の同じ順序に一致するようにを並べ替える必要がありNSMutableArray
indexes
ます。今私はこのようにやっています:
int a;
for (a=0; a<self.array.count; a++) {
NSString *key = [self.array objectAtIndex:a];
NSString *object = [self.dictionary objectForKey:key];
if (object !=nil) {
[self.array removeObjectAtIndex:a];
[self.array insertObject:object atIndex:a];
}
}
NSMutableDicitioanry
の順序に一致するようにこれを並べ替えるより良い方法はありNSMutableArray
ますか?
ありがとうございました!