Re: sort array of dictionaries by multiple critera

2011-04-27 Thread Graham Cox
On 27/04/2011, at 11:59 PM, Martin Batholdy wrote: > [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)

Re: sort array of dictionaries by multiple critera

2011-04-27 Thread Steve Christensen
Either of these would allow you to do what you want for NSArray: - (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr; - (NSArray *)sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))comparator context:(void *)context; And these for NSMutableArray: - (void)sortUsingComparator:(NSCom

Re: sort array of dictionaries by multiple critera

2011-04-27 Thread Dave DeLong
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 B