Re: "Default" Value In Object
Re: "Default" Value In Object
- Subject: Re: "Default" Value In Object
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 17 Jun 2005 19:31:13 -0700
On Jun 17, 2005, at 4:47 PM, Thaddeus Cooper wrote:
I have an entity that has several attributes. One of the attributes
s starts off empty when the first object is created. When the user
changes its value, in the form that should be the new value for
subsequent objects. Let's say that the field is changed to 42A in
the last object that was added to the graph, then until the user
changes it, the subsequent values for attribute s will be 42A.
There are many different ways you could do this, depending on your
application architecture.
The managed objet model is immutable after it's been used, so you
can't update the default attribute value in the running application.
How are you adding new objects? If you're using an array controller,
I'd consider creating a subclass of NSArrayController, setting it as
the delegate of the text field, and recording user edits. Keep a
record of the last value set, and set it for new objects in
newObject. If this value needs to be carried over from one run of
the application to another, then you could store it either in the
store's metadata, or in user defaults, depending on your needs...
mmalc
_______________________________________________
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