开发者

NSMutableDictionary Enumeration

I us开发者_StackOverflow社区ed 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.


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.


found via this thread last year, you'll find a good OrderedDictionary class here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜