• 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
best method for observing changes in NSArrayControllers content
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

best method for observing changes in NSArrayControllers content


  • Subject: best method for observing changes in NSArrayControllers content
  • From: Michael Link <email@hidden>
  • Date: Thu, 16 Feb 2006 16:23:17 -0600

I have an instance of NSArrayController (lets call it controller1) that has its contentArray bound to the arrangedObjects of another NSArrayController (lets call it controller0). controller1 also sets a filterPredicate (e.g. the predicate filters red colored objects). I've noticed that the content of controller1 is only updated when arrangedObjects changes in controller0 (as expected). But if I changed the color of one of the objects in controller0 to say blue, it doesn't update in controller1. I think I need to somehow observe a key of all the objects in controller0 and send controller1 a rearrangeObjects. I'm wondering what the best method for this might be? Subclass NSArrayController and KVO the objects as they are inserted? Which method needs to be subclassed, addObject? setContent? If I subclass setContent can I call addObserver on a KVO compliant object multiple times? Do I have to remove the observer before the object is released, or will that happen automatically? Thanks for any insight.

--
Michael

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

  • Prev by Date: Re: why would anyone want to do that?
  • Next by Date: Re: resize text lines when nstextview is resized
  • Previous by thread: Re: resize text lines when nstextview is resized
  • Next by thread: NSCComboBox Question
  • Index(es):
    • Date
    • Thread