核心数据应用于NavigationController

时间:2011-08-15 22:34:59

标签: core-data

I would like to set this up:

** UINavigationController **                       ** Core Data **
- RootView (Table of Courses-of-Study)             - [CourseOfStudy entity]
-- didSelectRowAtIndexPath --> DetailView          -- [StudyMaterial entity](list of Qs)
-- DetailView consists of:
--- TextView  (on top)                             --- [Question entity]
--- TableView (on bottom, subview of DetailView)   --- [Answers entity, Distractors entity]

How do relate my courses of study directly with their respective/detail-view/child data?

Thanks

1 个答案:

答案 0 :(得分:1)

主/根表视图中的每一行都代表一个特定的CourseOfStudy对象。当用户选择该行时,您将知道需要哪个CourseOfStudy对象。在DetailView控制器中创建一个属性来保存CourseOfStudy对象。在将DetailView控制器推送到NavigationController的堆栈之前,请将该属性设置为所选的CourseOfStudy对象。

......你已经完成了。 DetailView控制器现在具有正确的CourseOfStudy对象,并且可以显示它的属性。