I having problems to sort an NSArray of custom objects. The NSArray has to be sorted by a method that returns an int value (so it's not an object's attribute) and by an attribute that belongs to the object.
So suppose that my array contains an NSArray of PolygonObject. Each PolygonObject has plenty of attributes, and one of them is 'height'. Beside that, I want to sort the array by calculating the area of each polygon. So I want to sort the array by 'area' (using method that calculates the area) and by height (simple attribute of the object).
I know how to sort an NSArray using a method (sortedArrayUsingComparator, sortedArrayUsingSelector...) and using a key (NSSortDescriptor), but I have no idea about how to sort it using both.
How can I do it?