I saw many examples for Custom sort for NSMutableArray , here one of them How to sort an NSMutableArray with custom objects in it?, but I have an object with a and b, and I want to sort them according to a*b.
I saw this code for example
NSSortDescriptor *sortDescriptor;
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"birthDate"
ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray;
sortedArray = [drinkDetails sortedArrayUsingDescriptors:sortDescriptors];
But I do not have birthDate here I need to sort according to a*b (both double)?
More details,
I have a NSMutableArray that contains CGRect objects, and I want to sort them according to width*height