In that array of sort descriptors, you'd need to pass two of them. The first to 
sort by type and the second to sort by date. The second sort descriptor would 
only be used if two objects are sorted as equal by the first descriptor. 

Dave

Sent from my iPhone

On Apr 27, 2011, at 6:59 AM, Martin Batholdy <batho...@googlemail.com> wrote:

> Hi,
> 
> I have an array of dictionaries.
> 
> One dictionary-entry looks like this:
> 
> {
>    ID = 34;
>    counter = 2;
>    date = "2011-04-19 15:43:52 +0200";
>    title = "test.pdf";
>    type = file;
> }
> 
> Now I would like to sort my array of dictionaries first by type and then 
> (within the type-dictionaries) by date.
> 
> I can sort my array by one critierion with a NSSortDescriptor:
> 
> NSSortDescriptor *descriptor;
> descriptor = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:NO];
> [bookmarks sortUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]];
> 
> 
> but how can I first "group" the dictionaries by type and then within the 
> types sort them by date?
> (so use two sorting-criteria with a different priority)
> 
> 
> 
> thanks for any suggestions!_______________________________________________
> 
> 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/davedelong%40me.com
> 
> This email sent to davedel...@me.com
_______________________________________________

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 arch...@mail-archive.com

Reply via email to