• 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: Notification when changes occur to an array?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification when changes occur to an array?


  • Subject: Re: Notification when changes occur to an array?
  • From: Scott Anguish <email@hidden>
  • Date: Wed, 27 Sep 2006 11:16:48 -0400

as someone else has pointed out Key-Value Observing is the proper technique for this.

Have a look at the KVO doc, and also the first item in the Cocoa Bindings troubleshooting doc. That lists a common gotcha (not adding items to the array in a KVO/KVC compliant manner)




On Sep 26, 2006, at 10:07 AM, Mattias Arrelid wrote:

Hi everyone,

This is my first post here, so be easy on me. I've searched the archives and Google without success, so now I ask you for your expert input.

The problem; I have an NSArrayController with a corresponding NSArray. I would like some of my other classes to react to changes to the array, at least when it changes size.

I've read the class reference for both the controller and the array, but I cannot seem to find any built in notification support for the array as a whole (like when an element is added, a "sizeHasChanged" notification should be sent).

I could manually check the size of my array at each instance in my program where it's needed, but that breaks the notification idea.

_______________________________________________
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


References: 
 >Notification when changes occur to an array? (From: Mattias Arrelid <email@hidden>)

  • Prev by Date: Re: Dragging a file and place it inside a Menu
  • Next by Date: Using DiskArbitration framework in a Cocoa application
  • Previous by thread: Re: Notification when changes occur to an array?
  • Next by thread: Problem with relationships in Core Data
  • Index(es):
    • Date
    • Thread