Imaginativeone
Imaginativeone

Reputation: 107

Core Data Applied to a NavigationController

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

Upvotes: 0

Views: 68

Answers (1)

TechZen
TechZen

Reputation: 64428

Each row in the Master/Root tableview will represent a particular CourseOfStudy object. When the user selects that row, you will know which CourseOfStudy object is needed. Create an attribute in DetailView controller to hold a CourseOfStudy object. Before you push the DetailView controller onto the NavigationController's stack, set the attribute to the selected CourseOfStudy object.

...and you're done. The DetailView controller now has the correct CourseOfStudy object and can display it's properties.

Upvotes: 1

Related Questions