Re: CoreData, Object/Array Controllers and KVO
Re: CoreData, Object/Array Controllers and KVO
- Subject: Re: CoreData, Object/Array Controllers and KVO
- From: "Jeff Hellman" <email@hidden>
- Date: Thu, 14 Aug 2008 13:49:39 -0700
Ok...So a bit more detail:
I am setting the content of the NSObjectController (which is an
IBOutlet) to a managed object that I've fetched in the
WindowControllerDidLoadNib method of my application.
I have one NSTextField in my NIB. If I don't bind a value from the
ObjectController to the TextField, the app opens fine and no calls are
made during open to the two functions mentioned earlier
(willChangeValueForKey: and didChangeValueForKey:).
As soon as I bind the text field value to a key path (self.title or
just title) in the ObjectController, then the below methods are called
for each and every key in my ManagedObject.
The real question is this: I'd like to set a "lastUpdated" key with
the current time when a change is made to the object. Obviously,
opening the file doesn't constitute a change being made so I can't
have the currentTime being set upon file open without problems.
Thanks-
Jeff
On Thu, Aug 14, 2008 at 3:56 AM, I. Savant <email@hidden> wrote:
> On Aug 14, 2008, at 1:46 AM, Jeff Hellman wrote:
>
>> - (void)willChangeValueForKey:(NSString *)key
>>
>> is called. So is
>>
>> - (void)didChangeValueForKey:(NSString *)key
>>
>> Why is this? I'm not actually changing the object values, am I?
>
> If you know that, you should be able to see what key changed. From there,
> it should be a short hop to determining the actual object in question.
> Without at least this (and an explanation of what this object is and how
> it's used in your application), all we can do is shrug. :-)
>
> --
> I.S.
>
>
>
--
Jeff Hellman
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden