核心数据遍历具有 NSArrayController 内容集的实体?
我的核心数据应用程序中有 3 个实体:
Projeto <-->>服务<-->>雪骚 (关系的命名与往常一样)。
Projeto.servico(对多个 Projeto --> Servico)
Servico.projeto(与一个 Servico --> Projeto 相反)
Servico.sessaoDoServico(对许多 Servico --> Sessao)
Sessao.servicoDaSessao(与一个 Sessao 相反 -- > Servico)
每个实体都连接到一个数组控制器,就像Apple中的“部门和员工”文档。它在典型的主 - 详细信息配置中工作正常。
现在我想拥有选定项目中的所有会话。 (我在 Sessao 和 Projeto 之间没有关系)
我试图绑定 SessionArrayController 内容集来过滤会话,但没有成功。
我如何才能获得选定项目的所有会话?
我为会话类创建了一个属性,返回一个 NSSet,我可以打印所需的会话,但我不知道如何通过绑定来做到这一点。
-(NSSet *)sessoesDoProjeto{
NSSet *allSessions = [self.projeto.servico valueForKey:@"sessaoDoServico"];
NSLog(@"allSessions %@",allSessions);
return allSessions;
}
我可以用上面的 NSSet 创建一个 NSArrayController 吗?
任何帮助将不胜感激
I have 3 entities in a Core Data application:
Projeto <-->> Servico <-->> Sessao
(the relationships are named as usual).
Projeto.servico (to many Projeto --> Servico)
Servico.projeto (inverse to one Servico --> Projeto)
Servico.sessaoDoServico (to many Servico --> Sessao)
Sessao.servicoDaSessao (inverse to one Sessao --> Servico)
Each entity is connected to an array controller, like "Department and employees" in Apple Docs. It's Working fine in a typical Master - details configuration.
Now I want to have all Sessions from a selected Project. (I don't have a relationship between Sessao and Projeto)
I'm trying to bind the SessionArrayController Content Set to filter the sessions without success.
How could I have all sessions for a selected project?
I created a property for the Session Class, returning a NSSet and I can print the desired sessions, but I have no idea, how I could do it with binding.
-(NSSet *)sessoesDoProjeto{
NSSet *allSessions = [self.projeto.servico valueForKey:@"sessaoDoServico"];
NSLog(@"allSessions %@",allSessions);
return allSessions;
}
Could I create a NSArrayController with the above NSSet?
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案,所以我发布给其他有同样问题的人。
我将 SessionArrayController 的内容数组(不是内容集)绑定到:
它的工作原理就像一个魅力!
I found the solution, so I'm posting for others with the same problem.
I bound the Content Array (not content set) of the SessionArrayController to:
It works like a charm!