On 25 Aug 2008, at 9:36 am, JArod Wen wrote:

It should be the problem when enumerating the dictionary, right? How can I control the order of enumerating?



You can't if you enumerate the keys directly - there is no concept of "order" for the items of a dictionary. But you can copy them into a mutable array and sort it as you wish, then enumerate that.


I got the key-value pairs in NSDictionary as following:

       "ang (A)" = 2;
       "dis (D)" = 1;
       "pos (P)" = 0;
       "shp (S)" = 3;


Maybe a dictionary isn't the right data structure for the task at hand? An array might be more appropriate, as it includes the concept of "order". You appear to be using the dictionary keys to look up an integer position. Instead, why not just store the column names in an array where the index is the position?

hth,

Graham




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to