• 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: wasting space?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wasting space?


  • Subject: Re: wasting space?
  • From: Erik Buck <email@hidden>
  • Date: Mon, 6 Oct 2008 14:26:40 -0700 (PDT)

I am very confused here. KVO has nothing to do with a call like
valueForKeyPath:, other than the obvious fact that they are both built
on the idea of key paths. The
observeValueForKeyPath:ofObject:change:context: method doesn't
interact with valueForKeyPath: in any way, and so I don't really
understand what you're getting at here.

If you don't override observeValueForKeyPath:ofObject:change:context:,
how are you supposed to use KVO at all? As far as I understand it,
that is the *only* way to get notified of changes to things you
observe.

Apple's various NSController subclasses handle KVO and bindings for you.
 
NSController subclasses automatically call -valueForKeyPath: or -valueForKey: or -setValue:forKey:. 
 
The -observeValueForKeyPath:ofObject:change:context: _does_ interact with -valueForKeyPath: because the various NSController subclasses exist in part to provide exactly that interaction.
 
You do often need to call  -bind:toObject:withKeyPath:options:.
 
You really don't need to override -observeValueForKeyPath:ofObject:change:context:.  Or at least I haven't needed to override it because one of the existing NSController subclasses usually meets my needs.
_______________________________________________

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: wasting space?
      • From: Rob Keniger <email@hidden>
    • Re: wasting space?
      • From: "Michael Ash" <email@hidden>
  • Prev by Date: Re: wasting space?
  • Next by Date: Universal app fails on PPC.
  • Previous by thread: Re: wasting space?
  • Next by thread: Re: wasting space?
  • Index(es):
    • Date
    • Thread