-
蓝山帝景
这样使用NSSortDescriptor..NSSortDescriptor * descriptor = [[NSSortDescriptor alloc] initWithKey:@"interest" ascending:YES];stories = [stories sortedArrayUsingDescriptors:@[descriptor]];recent = [stories copy];stories是要排序的数组。recent是另一个具有排序字典值的可变数组。@"interest"用必须排序的键值更改。祝一切顺利
-
白衣染霜花
[array sortUsingDescriptors:[NSArray arrayWithObjects:[NSSortDescriptor sortDescriptorWithKey:@"YOUR-KEY" ascending:YES], nil]];我真的不想将其分成多行。对我来说已经足够简单了。
-
一只名叫tom的猫
Update,sortUsingDescriptors现在是sortedArrayUsingDescriptors因此,它像:items = [items sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];