谢谢
(注意myComparison是您自己的比较两个键的方法).
NSMutableArray* tempArray = [NSMutableArray arrayWithArray:[myDict allKeys]]; [tempArray sortedArrayUsingSelector:@selector(myComparison:)]; for (Foo* f in tempArray) { Value* val = [myDict objectForKey:f]; }