2013-03-17 65 views

回答

1

你需要讓員工NSArray首先,它使用NSSortDescriptor像往常一樣 排序這裏是我的代碼

NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Contacts" ofType:@"plist"]; 
NSDictionary *contacts = [NSDictionary dictionaryWithContentsOfFile:plistPath]; 
NSArray *staff = [contacts objectForKey:@"Staff"]; 

NSSortDescriptor *sortDesc = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; 
NSLog(@"%@", [staff sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDesc]]); 

感謝

+0

感謝您的回答!剛纔發現它,但仍然感謝你回答我! /雅各布 – Jacob 2013-03-20 17:15:24