• 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: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController


  • Subject: Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
  • From: Shaun Wexler <email@hidden>
  • Date: Thu, 7 Oct 2004 11:45:04 -0700

On Oct 7, 2004, at 10:44 AM, Gabriele de Simone wrote:

I think you are misunderstanding what automaticallyNotifiesObserversForKey: does. If you return NO, you are just declaring the intention to call willChangeValueForKey: and didChangeValueForKey: yourself (which is what I am doing in the example). Even if I change my code to return YES for myKey (from automaticallyNotifiesObserversForKey: of course), the notification for the dependent key is not sent.

Again, the point of the question is not that I don't want to call rearrangeObjects, but to understand why the notification is not being triggered.

See, the way Cocoa bindings knows that myKey changed is because it substitutes a subclass of your class, somewhat transparently to the runtime, and overrides your method -setMyKey: thus vectoring it thru a notification method which wraps your actual method IMP with the will/did change notifications, as well as any dependent notifications. The only way Cocoa bindings can issue these dependent notifications for you is if you DON'T disable them by returning NO when it queries your class... returning YES from the method +automaticallyNotifiesObserversForKey: tells the bindings layer it is okay to take care of this for you, as I've described above. If you want to override this behavior, simply return NO and issue your own notifications. This is why it's not working for you; you've disabled notifications, including dependent ones. There's nothing wrong with this, other than now you have to do everything yourself in -setMyKey:

HTH~
--
Shaun Wexler
MacFOH
http://www.macfoh.com

_______________________________________________
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
  • Follow-Ups:
    • Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
      • From: Gabriele de Simone <email@hidden>
References: 
 >triggerChangeNotificationsForDependentKey in subclass of NSArrayController (From: Gabriele de Simone <email@hidden>)
 >Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController (From: Shaun Wexler <email@hidden>)
 >Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController (From: Gabriele de Simone <email@hidden>)

  • Prev by Date: Re: Memory management and Objects.(Newbie)
  • Next by Date: what is the best (easiest) way to get the selection in an NSOutlineView?
  • Previous by thread: Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
  • Next by thread: Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
  • Index(es):
    • Date
    • Thread