• 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: NSArrayController using an external NSArray?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController using an external NSArray?


  • Subject: Re: NSArrayController using an external NSArray?
  • From: Ron Aldrich <email@hidden>
  • Date: Thu, 19 Apr 2007 17:25:24 -0700


On Apr 19, 2007, at 5:12 PM, Todd Heberlein wrote:

Note: I have found this problem mentioned in the "Troubleshooting Cocoa Bindings" in the "Cocoa Bindings Programming Topics" document. I am still trying to grok it, however.

You're having this problem, because NSMutableArray, in itself, isn't KVO compliant.


You can, however, request a proxy for the array which is KVO compliant.

Instead of:

[myArray addObject: anObject];

use

[[self mutableArrayValueForKey: @"myArray"] addObject: anObject];

The trick here is that the object returned by mutableArrayValueForKey: is not actually your NSMutableArray, it's a proxy to it which contains the extra information and code needed to make it KVO compliant.

Ron Aldrich
Software Architects, Inc.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSArrayController using an external NSArray?
      • From: Todd Heberlein <email@hidden>
References: 
 >NSArrayController using an external NSArray? (From: Todd Heberlein <email@hidden>)
 >Re: NSArrayController using an external NSArray? (From: Todd Heberlein <email@hidden>)

  • Prev by Date: NSTableView, NSPopupButtonCell, no selection
  • Next by Date: Re: Non-rectangular cursor tracking regions
  • Previous by thread: Re: NSArrayController using an external NSArray?
  • Next by thread: Re: NSArrayController using an external NSArray?
  • Index(es):
    • Date
    • Thread