Sort NSDictionary keys as NSDate

前端 未结 2 918
梦如初夏
梦如初夏 2021-01-13 23:29

I\'m developing an iOS 4 application with latest SDK and XCode 4.2.

I have a NSMutableDictionary where keys are NSDate and

2条回答
  •  广开言路
    2021-01-14 00:09

    Try this code:

    NSArray *sortedArray = [[myDict allKeys] sortedArrayUsingSelector:@selector(compare:)];
    

    But note that you cannot sort a dictionary, as it is based on key-value lookups, not indexed lookups.

提交回复
热议问题