NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"recordDate" ascending:YES];
NSArray *sortedArray = [queryArray sortedArrayUsingDescriptors:@[sortDescriptor]];
這裡要注意SortDescriptors是陣列,他會以第0個item為主,如果遇到二筆以上同順序的,才會以之後的item來排列。
沒有留言:
張貼留言