CoreData and Bindings - a single, simple entity with bindings
CoreData and Bindings - a single, simple entity with bindings
- Subject: CoreData and Bindings - a single, simple entity with bindings
- From: Marcus Roberts <email@hidden>
- Date: Sun, 1 May 2005 09:59:49 +0100
I've been trying out CoreData, reading through the excellent
cocoadev.com tutorials, and the documentation on Apple's developer
site. All of the examples so far link an interface of tables
through NSArrayControllers back to the managed context. These all
work fine.
What I'm trying to do is instantiate a single entity object in a
document. Taking it back to basics, I defined an entity in the data
model, with two fields, name and email. I then option-click and drag
the entity onto a new empty document window in Interface Builder, and
when asked, choose One Object instead of Many Objects.
When I run the application created, the document window appears, with
two empty fields, but the document data is marked as needing to be
saved, as the red window close button has the dark dot in the middle.
If I type into each text field, then press Apple-Z to undo, the two
fields clear in turn, and then they become disabled with "No
Selection" written in them.
I'm not quite sure what's happening here. In an equivalent 10.3
program, I would have instantiated a model object, and using bindings
and an NSObjectController linked the view to the model. The document
wouldn't need saving until the user typed values into the field.
Can anyone explain the behaviour - I'm guessing it's probably pretty
simple, and to do with the managed context's behaviour in creating an
entity object, but I'm not sure. Or is it more complex, and due to
needing a graph of objects rather than just a single object?
Thanks
Marcus
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden