【发布时间】:2011-04-10 03:12:20
【问题描述】:
所以我有以下代码,通过“颜色”属性对核心数据获取进行排序。
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"color" ascending:YES];
sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
有没有办法获取该排序的结果,现在在每个颜色“组”中按日期(另一个属性)进行子排序?
基本上这是我现在得到的一个例子......
RED - 11/1/2010
RED - 9/8/2010
RED - 11/9/2011
RED - 10/20/2011
GREEN - 11/1/2010
GREEN - 9/8/2010
GREEN - 11/9/2011
BLUE - 10/20/2011
BLUE - 11/1/2010
BLUE - 9/8/2010
这就是我希望结果的样子...
RED - 9/8/2010
RED - 11/1/2010
RED - 10/20/2011
RED - 11/9/2011
GREEN - 9/8/2010
GREEN - 11/1/2010
GREEN - 11/9/2011
BLUE - 9/8/2010
BLUE - 11/1/2010
BLUE - 10/20/2011
我确信这可以做到,但我只是不知道如何做到这一点。
【问题讨论】:
-
Stephano,如果您认为问题不再有用,您可以删除您的问题(使用问题文本下方的“删除”链接)。