在第二视图控制器中显示多对一关系数据的核心数据 [英] core data displaying to-many relationship data in second view controller

查看:100
本文介绍了在第二视图控制器中显示多对一关系数据的核心数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相当新的,所以请与我裸露,我的核心数据模型看起来像这2个实体与第一个TableViewController显示区,当用户选择区,它推到第二个视图,并显示学校在该区。我有第一个TableViewController与NSFetchedResultController设置和显示正确的entityForName @区,但我目前卡住和失败推送数据到第二个视图控制器有一个自定义表单元格控制器。

I am fairly new to this, so please bare with me, my core data model look like this 2 entities with the 1st TableViewController displaying the districts, and when user selected the district, it pushes to the 2nd view and display the schools in that district. I have the 1st TableViewController with the NSFetchedResultController setup and display correctly entityForName @"District" , but I am currently stuck and failing on pushing the data to the 2nd view controller which has a custom table cell controller.



名称



__

schools< --- to-many relationship ---- >> indistrict

District
name
province
__
schools <--- to-many relationship ---->> indistrict

学校

名称

电话

图片

__

indistrict<< --- to-one relationship ---> schools

School
name
phone
image
__
indistrict <<--- to-one relationship ---> schools

如果任何人可以向我展示如何将数据传递到第二个视图控制器的代码示例,这将是巨大的。非常感谢〜

It would be great if anyone could show me the code example on how to pass the data to the 2nd view controller. Much appreciated~

推荐答案

您只需将选定的学校数据传递给第二个视图控制器,然后使用相同的搜索, p>

You just pass the selected school data to second view controller, you then use the same search but with

[NSString stringWithFormat:@"district.school.name == %@", school.name] 

这篇关于在第二视图控制器中显示多对一关系数据的核心数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆