I have a method that I keep in a Util class that looks like this:

public static final NSArray orderArrayByKey(NSArray objects, String key){
if (objects == null) {return null;}
NSArray sortSpecs = new NSArray(EOSortOrdering.sortOrderingWithKey(key, EOSortOrdering.CompareAscending));
return EOSortOrdering.sortedArrayUsingKeyOrderArray(objects, sortSpecs);
}


Just pass in the array and the key or keypath that you want and it does its thing.  this is for ascending, but you can also make one for descending or make the selector a parameter.

John

On Sep 13, 2006, at 11:38 AM, Matt Kime wrote:

Does sortArrayUsingKeyOrderArray support sorting based on the
attributes of a related object? Or do I need to make sense of
NSComparator? (anyone know of any good examples?)

thanks,
matt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to