• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CoreData, Object/Array Controllers and KVO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CoreData, Object/Array Controllers and KVO
      • From: Quincey Morris <email@hidden>
References: 
 >CoreData, Object/Array Controllers and KVO (From: "Jeff Hellman" <email@hidden>)
 >Re: CoreData, Object/Array Controllers and KVO (From: "I. Savant" <email@hidden>)

  • Prev by Date: drawRect is erasing view
  • Next by Date: Re: drawRect is erasing view
  • Previous by thread: Re: CoreData, Object/Array Controllers and KVO
  • Next by thread: Re: CoreData, Object/Array Controllers and KVO
  • Index(es):
    • Date
    • Thread