Re: Data Model, Core Data
Re: Data Model, Core Data
- Subject: Re: Data Model, Core Data
- From: Fritz Anderson <email@hidden>
- Date: Wed, 9 Jul 2008 16:01:11 -0500
On 9 Jul 2008, at 1:43 PM, R T wrote:
I've created a simple model, to create an NSTableView and add &
remove buttons. The table has 3 columns/attributes, labeled red,
green & blue. Each attribute has "Optional" selected (not
"Transient" or "Indexed"). The "Type:" for all three are Integer 16.
I need to use the numbers in the cells in equations. How do I get
the numbers back out of the table. I have read & tinkered for 3 days
now and am beginning the think the "Data" is only readable from a
computer monitor....this can't be. Any ideas greatly appreciated.
Rick Tschudin
email@hidden
note: I've been trying to access the numbers thru the myDocument
files generated choosing the "New Project" choice "Core Data
Document-based Application".
1. This is a Cocoa question, which should be directed to the cocoa-dev
mailing list. It doesn't have anything particularly to do with Xcode.
2. NSTableView doesn't keep data, it just displays it. You get data
from the underlying model object that (additionally) supplies that
data to the table view for display. In this case, the model object is
an NSManagedObject of the entity type you created in the data model
diagram. If you have a NIB, a table that works, and a data model, you
have an NSArrayController in the NIB that can tell you which object in
the table is currently selected. (-[NSArrayController selectedObjects])
You'll need to get a reference to the array controller. Create an
outlet (IBOutlet instance variable) in whatever class is the File's
Owner for the NIB (probably your NSPersistentDocument subclass, if
you're getting everything off-the-shelf), and connect it (in Interface
Builder) to the array controller. That instance variable will then
contain a pointer to the NSArrayController you have to send
selectedObjects to.
This is very summary, I know. The details and concepts are best left
to the overview of Core Data in the documentation.
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden