-4

I have a Dictionary

AlphaSite
BetaSite
GammaSite

I saw how can I sort NSMutableDictionary with keys value? but didnt help me much

dictionaryOfWebsites = [[NSMutableDictionary alloc] init];
[dictionaryOfWebsites setObject:@"http://www.site1.com" forKey:@"AlphaSite1"];
[dictionaryOfWebsites setObject:@"http://www.site2.com" forKey:@"GammaSite2"];
[dictionaryOfWebsites setObject:@"http://www.site3.com" forKey:@"ZetaSite3"];
[dictionaryOfWebsites setObject:@"http://www.site4.com" forKey:@"BetaSite4"];

I want to sort the Dictionary so my results are in alphabetical order (by keys)

Community
  • 1
  • 1
Cocoa Dev
  • 9,361
  • 31
  • 109
  • 177

1 Answers1

1

You better off just creating a quick class with 2 properties. Site and Url. Then you can just place them into an array and sort by Site. Like H2C03 said, dictionaries are not intended for sorting purposes.

Esko918
  • 1,397
  • 1
  • 12
  • 25
  • I guess I'll have to add that later. First I'll make sure the app is "functional" before I start venturing into the great unknown – Cocoa Dev Apr 29 '13 at 21:37