Re: Core data "now"
Re: Core data "now"
- Subject: Re: Core data "now"
- From: "I. Savant" <email@hidden>
- Date: Mon, 6 Nov 2006 13:32:43 -0500
Matthew:
You shouldn't change the value in your view. This goes against the
MVC paradigm, upon which Cocoa is built. You should instead change
the model (the managed object in this case) directly. You can do this
by getting your controller's current selection and changing its (the
selection's) properties.
Also, if you create your own NSManagedObject subclass (and set
your entity to use that class instead of NSManagedObject), you can
set default values in its -awakeFromInsert method.
--
I.S.
On Nov 6, 2006, at 1:09 PM, Matthew Weinstein wrote:
Dear cocoa-xperts,
I have an app I'm working on which uses core data, and I created
the interface using the drag and drop from the core data model and
then tweaking. Here's the problem: I have a date field and I want
it to default to "now" whenever I hit add. So I thought what I'd
do is have an action in my document which is triggered by the add
button so that it sends an add: to the array controller; fills in
@"Now" in my date field. Now that works, in terms of filling in the
current date (though not time) in the NSTextField, but it doesn't
actually update the database?
How do I get my database to see that the field has changed and
update appropriately?
Matthew Weinstein
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
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