排序
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
items = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"springs" ofType:@"plist"]];
NSSortDescriptor *s = [NSSortDescriptor sortDescriptorWithKey:@"admArea" ascending:YES];
NSSortDescriptor *s1 = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES];
NSArray *aa = [items sortedArrayUsingDescriptors:@[s, s1]];
for (int i=0; i < aa.count; i++) {
NSLog(@"%@ %@", aa[i][@"admArea"], aa[i][@"title"]);
}
}
留言
張貼留言