NSMutableArray *array1 = [NSMutableArrayarray];
.....
NSSortDescriptor *sorter = [[NSSortDescriptoralloc] initWithKey:@"priority"ascending:NO];
NSArray *array2 = [array1 sortedArrayUsingDescriptors:[NSArrayarrayWithObject:sorter]];
这样得到的array2 ascending为NO则是按照priority 的大小从大到小排列的 ascending为YES则是从小到大排列
如果array中的元素里 priority 是NSNumber则比较数字大小,如果是字符串则按照字符串比较