核心数据中间实体
有 3 个实体
- Father ---->Name
- Son ---->Name
- FatherSon---->ID
关系
- Father --->>fatherson
- Son --->sonfather
- FatherSon-->ID父亲---->>父亲,儿子---->儿子父亲
我使用中间表来保存父亲和儿子之间的关系。父与子之间没有直接关系。
现在,
我可以将父子关系保存到FatherSon实体中。
- 我的主要问题是使用 FatherSon 的关系从 Son 实体访问 Son 名称。
- 使用FatherSon 的关系从Father 实体访问Father 名称。
所有信息都显示在表格视图中。
当我在表格视图中选择父亲姓名时。 didselect 事件必须进入详细信息视图 并显示与父亲相关且儿子相同的儿子姓名列表。
There are 3 entity
- Father ---->Name
- Son ---->Name
- FatherSon---->ID
Relationships
- Father --->>fatherson
- Son --->sonfather
- FatherSon-->father---->>fatherson, son---->sonfather
I have use intermediate table to save relations between Father and Son. There is no direct relation between Father and Son.
Now,
I am able to save the relation of father and son into FatherSon Entity.
- My main problem is to access a Son name from Son entity using the relation of FatherSon.
- TO access Father name from Father entity using the relation of FatherSon.
All the information is to shown into tableview.
When i select Father name in the tableview. The didselect event has to take to details view
and show the list of Son name that Father is related to and the same for Son.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否 100% 理解你的问题,但这里是。 。 。
在核心数据术语中,我假设您有类似的内容:
fatherSons
的属性因此,从一个到另一个应该很简单:
因此,在表视图中,您将使用
显示特定儿子的父亲并
父亲的所有儿子的列表
获取给定特定 出于兴趣。 。 。
为什么你必须使用中间表 - 当然应该是
(好吧,从技术上讲,我有 Child 而不是 Son,但是嘿,我不知道你的应用程序是什么!)
I'm not sure I 100% understand your question but here goes . . .
In Core Data terms I assume that you have something like :
fatherSons
So, to get from one to the other should be simple :
So in your table view you would use
to display the father of a particular son and
to get the list of all the sons given a particular father
Just out of interest . . .
Why do you have to use an intermediate table - surely it should be
(well, technically I'd have Child instead of Son but hey, I don't know what your app is!)