Re: CoreData and Bindings - a single, simple entity with bindings
Re: CoreData and Bindings - a single, simple entity with bindings
- Subject: Re: CoreData and Bindings - a single, simple entity with bindings
- From: Marcus Roberts <email@hidden>
- Date: Sun, 1 May 2005 10:30:12 +0100
Earlier I wrote:
> 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 think I understand now - asking something aloud always seems to set
the right though processes in action :-)
I started the application again, and this time the document object is
instantiating an entity object in its constructor, using:
person = [NSEntityDescription
insertNewObjectForEntityForName:@"Person"
inManagedObjectContext:[self managedObjectContext]];
and I bind the view to this using the NSObjectController's
ContentObject binding.
This solves the No Selection problem - I of course need to instantiate
an object in the document to bind to (this is done by the
arraycontroller in the multiple entity version).
I guess the document is marked as needing saving because I've
instantiated an object in the managed context. What's the proper way
of handling this? I don't want the document to need saving until the
user modifies a value in the document.
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