nsenumerator

NSMutableDictionary Enumeration


I used both object and key NSEnumerators to look through a dictionary and I noticed that it changes the order in which it enumerates through the dictionary. I find that rather annoying. Is there a way to get the NSEnumerator object or key, to look through in the order in which I created it? Formatting it into an NSArray isn't an option.


Solution

  • a dictionary is inherently not an ordered set so it doesn't matter in which order you store your data in it. you could use an nsarray and store your keys in it and then invoke your objects from the dictionary in the order stored in that array.