0
我有一個NSArray的UILocalNotification對象,需要根據UILocalNotification的userInfo屬性(它是NSDictionary)中的鍵進行排序。我知道如何對NSArrays進行一層深度的排序,例如NSDictionaries數組中的一個鍵,但是我輸了兩層。我想這樣做是僞代碼:通過2級深度的鍵值關係對NSArray進行排序
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"userInfo.personName" ascending:YES];
//the personName key within the userInfo NSDictionary property of a given UILocalNotification
NSArray *sortDescriptors = [[[NSArray alloc] initWithObjects:&sortDescriptor count:1] autorelease];
NSMutableArray *sortedArray = [[[NSMutableArray alloc] initWithArray:[[UIApplication sharedApplication] scheduledLocalNotifications]] autorelease];
[sortedArray sortUsingDescriptors:sortDescriptors];
我以爲我記得那個地方的點語法! – 2010-07-03 08:19:02