Skip to content

Instantly share code, notes, and snippets.

@akinLiu
Created June 9, 2014 15:40
Show Gist options
  • Save akinLiu/5a96e61190b46199611d to your computer and use it in GitHub Desktop.
Save akinLiu/5a96e61190b46199611d to your computer and use it in GitHub Desktop.
多条件排序
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSSortDescriptor *descriptor1 = [[NSSortDescriptor alloc] initWithKey:@"endCalYear" ascending:YES];
NSSortDescriptor *descriptor2 = [[NSSortDescriptor alloc] initWithKey:@"endMonth" ascending:YES];
NSSortDescriptor *descriptor3 = [[NSSortDescriptor alloc] initWithKey:@"periodLength" ascending:YES];
NSArray *sortDescriptors = @[descriptor1, descriptor2, descriptor3];
[fetchRequest setSortDescriptors:sortDescriptors];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment