Possible Duplicate:
How to sequentialy access a dictionary??
I have a dictionary , I want to reitrive all keys in an array with the same order which exist inside the dictionary . The documentation on "allKeys" method of NSDictionary says the order of returned objects in array is not defined . What can be done to get the keys in the same order as that of the dictionary .
Thanks a lot in advance !!
So the question you were pointed to summarises the issue nicely, but the solutions offered could be a little bit too complex for your needs (if you didn't want / have the time to write a sub-class or your own data structure).
The quick and dirty alternative is simple to have an array that contains all the keys you want to access in the order you want to access them in. You can then simply match this array back to your dictionary to pull out values in the correct order.
精彩评论