I have the following code that sorts by ascending.
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"platform.name" ascending:YES];
NSMutableArray *sortedReleases = [NSMutableArray arrayWithArray:[theReleases sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]]];
[sortDescriptor release];
What I want to do is do a sort where:
-
Show the ones where a sortedRelease is flagged true
-
Sort the rest using acsending (how it is doing it currently)
How would I get about doing that?
The method
sortedArrayUsingDescriptors:sortDescriptorsis plural and takes an array so it implies you can have multiple sort descriptors which will be applied in the order they appear in the array.The following code will do the sort how you want providing I understood you right and you have the property
sortedRelease.Here’s the relevant section from the docs for NSArray