• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: sorting an array of dictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sorting an array of dictionaries


  • Subject: Re: sorting an array of dictionaries
  • From: Andy Lee <email@hidden>
  • Date: Mon, 1 May 2006 07:56:18 -0400

On May 1, 2006, at 7:39 AM, Nicko van Someren wrote:
Take a look at the NSSortDescriptor class. You should be able to do what you want with:
NSSortDescriptot *d = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES] autorelease];
NSArray *sorted = [myArray sortedArrayUsingDescriptors: [NSArray arrayWithObject: d]];

And if you want to sort the array in place, you can use - sortUsingDescriptors: (you did mention that you're using a mutable array).


--Andy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >sorting an array of dictionaries (From: Yorh <email@hidden>)
 >Re: sorting an array of dictionaries (From: Nicko van Someren <email@hidden>)

  • Prev by Date: How to put a icon in the tray?
  • Next by Date: Re: NSString into *arguments[]
  • Previous by thread: Re: sorting an array of dictionaries
  • Next by thread: NSString into *arguments[]
  • Index(es):
    • Date
    • Thread