2
我有一個名爲nsmarrMedicineInfo的nsmutablearray。我想通過使用NSSortDescriptor
來排序元素。當我執行下面的代碼時,它顯示NSUnknownKeyException
。我無法找到數組的關鍵。在iPhone中實現NSSortDescriptor?
NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"sort" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)] autorelease];
NSArray *sort = [NSArray arrayWithObject:sortDescriptor];
NSArray *sortedArray = [nsmarrMedicineInfo sortedArrayUsingDescriptors:sort];