Register FAQ/Rules Forum Spy Search Today's Posts Mark Forums Read

Welcome to the Mac Forums forums. Please read the FAQ if you have questions. Register to participate.

 
Go Back   Mac Forums > Apple Software > Mac Programming
TouchArcade.com - iPhone Game Reviews and News

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 4, 2009, 09:27 PM   #1
John Baughman
macrumors member
 
Join Date: Oct 2003
Core Data bindings - help understanding how it works

I am working through chapter 30 in Hillegass' book and have the core data project working fine, but do not understand how bindings do their trick. Here is a summary of the project as presented in the book.

We created a Core Data Document-Based Application. The MyDocument.xib to be used to swap out Department and Employee views...

1. Created a class of type NSViewController named ManagingViewcontroller and declared an NSManagedObjectContext object named managedObjectController.

2. Created 2 subclasses to managedObjectController, DepartmentViewController and EmployeeViewController

3. Created 2 new XIB files, DepartmentView and EmployeeView, with their File's Owner class set to DepartmentViewController and EmployeeViewController respectfully. These custom views to be used in the Mydocument.xib do display their respective data.

4. Created 2 entities, Department and Employee, in the the xdatamodel. Department was given one field deptName plus some related fields to Employees.

5. Created Managed Object Classes for the 2 entities Department and Employee.

6. In the Department managed object we have the variable deptName declared with @property (Department.h) and @dynamic (Department.m).

7. In the Department XIB we added 2 array controllers, Depts and EmployeeList, to display the Department and Employee entity's data.

8. In the custom view in the Department XIB we added table views to display the Department and Employee data.

9. We then made the following bindings...

Depts Array Controller Managed Object Context -> File's Owner
Departments Column (tv) Value -> Depts AC - Key Path -> deptName

What I am having trouble seeing is how the Depts Array Controller finds the deptName attribute when the view is loaded or finds the Department entity when adding or removing rows. I am thinking it should be..

TableColum (deptName) -> Dept AC -> File's Owner (Managed Object Context) -> DepartmentViewController -> ManagingViewController -> ???

I don't get there. I obviously still do not have handle on how the model connects to the controllers.

I'm probably not asking my question correctly. I am looking for a path from the Dept AC to the data which I think must be a path to the Managed Object Class Depatrment.h where deptName is declared

Same question with regard to adding or deleting. The add and delete buttons both have sent actions to Depts AC add and delete, which also lead me to dead ends.

Another question. We set the Delete button Enabled binding to the Depts AC canRemove controller key. The Add button doesn't have any bindings. Why was this necessary for the Delete button but not something similar for the Add button?

Hope I made my question clear enough for someone to help me understand how this is all working.

Thanks,

John
John Baughman is offline   Reply With Quote

Reply

Mac Forums > Apple Software > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:12 PM.

Mac News | Mac Rumors | iPhone Game Reviews | iPhone Apps

Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 2002-2010, MacRumors.com, LLC