【发布时间】:2013-07-15 10:07:22
【问题描述】:
我在核心数据中有一个事件实体 具有 eventName、eventDate、eventLocation 属性。我正在使用 SortDescriptors 作为 key eventDate。我在这里有一个问题,我需要设置位置首选项,我需要根据位置而不是键而是值来排序。例如,假设我将位置设置为“西雅图”,而不是所有具有西雅图位置的事件都应首先显示。您知道如何使用 FetchControllers 执行此操作吗?请在回答之前阅读问题
我不想
[NSSortDescriptor sortDescriptorWithKey:@"eventLocation" ascending:YES];
但是像
[NSSortDescriptor sortDescriptorWithKey:@"eventLocation==Seattle" ascending:YES];
(这是错误的,我知道这是谓词格式)
【问题讨论】:
-
所有事件都是数组或字典数组?
-
@RanjuPatel no not in array m using fetch controllers for table view 我希望委托方法也能正常工作..Db 不是静态的
-
@RanjuPatel 我不认为那是我的问题的答案。我知道 fetch Request 不允许使用 Objective C 排序描述符...我想像 preicates 那样做,但其他人应该也低于我的想要的
标签: objective-c core-data nssortdescriptor nsfetchedresultscontroller