As was stated by @Dan F, NSDictionary does not sort its entries. As was stated in the comment by @Hot Licks, NSDictionary puts its contents in arbitrary order. You should never assume anything about the order of entries in the dictionary. An NSArray is more appropriate for this kind of thing.
If you really want to display the contents of a dictionary in some pre-defined sort order, you can get a array of the keys ordered using the values they are associated with. The NSDictionary class has the keysSortedByValueUsingSelector:
and keysSortedByValueUsingComparator:
methods that support this. So if you wanted to control the display order by sorting the values into ascending order you could implement do something like this:
NSArray *orderedKeys = [myDictionary keysSortedByUsingSelector:@selector(caseInsensitiveCompare:)];
for (int i = 0; i < [sortedKeys count]; i++) {
NSString *key = [sortedKeys objectAtIndex:i];
NSLog(@"%@ = %@", key, [myDictionary objectForKey:key]);
}
The results should show each entry in the dictionary, sorted by the values within each entry.