如何使NSSortDescriptor按实体关系计数(xcode)排序?

时间:2011-09-08 03:09:12

标签: xcode iphone-4 nssortdescriptor

好的..这样的简单例子

firstEntity与secondEntity有一个名为“Relation”的关系,它是一对多的关系。

我想获取firstEntity的所有对象,但是按关系计数

排序

例如

fE1 has 1 relation to sE1
fE2 has 3 relation to sE2,sE3 and sE4
fE3 has 2 relation to sE5 and sE6

所以结果将

fE1 has 1 relation to sE1
fE3 has 2 relation to sE5 and sE6
fE2 has 3 relation to sE2,sE3 and sE4

像这样的问题..如何正确地使sortDescriptor?

====================

另一个例子:

NSString * sort=[NSString stringWithFormat:@"Business.@count"];

业务是关系

从表格Tag到表格商务

这意味着商业有标签关系,但标签有很多商业关系

是不是要制作那个sortString?

0 个答案:

没有答案