私は次のような内容の説明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ますか?
ありがとうございました!