• 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 usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController usage


  • Subject: Re: NSArrayController usage
  • From: Lee Morgan <email@hidden>
  • Date: Sun, 22 May 2005 23:21:23 -0400

On May 22, 2005, at 11:14 PM, Pierre Chatel wrote:

i'm trying to port portions of my code to use cocoa bindings: more specifically, NSArrayControllers.
But i've made an afflicting discovery: an array controller is not aware of changes made to the array programmatically (i mean, adding or removing objects of the array in your code for example) !
Shouldn't it be a default behavior of NSArrayController ?!
I guess i'll have to subclass the controller class or register for some events...

How would *you* do that ? ;-)

PS: maybe it's a silly question, but i've come across the same problem at  CocoaDev http://www.cocoadev.com/index.pl?NSArrayController. Here is an extract:

"Question: if I have an array in the model and I want it to be displayed in an NSTableView, but items can be added to the array from other places than the GUI, is an NSArrayController the right solution? cause if I add items to the array (from another source), they will not show in the NSTableView, unless I issue a will/didChangeValueForKey: with my actual array being the key. I.e. if my NSTableView is set to display "arrangedObjects.name" shouldn't that then trigger a notify, when new items are added to the array?

You can call [ myView reloadData ]; to update the display

No, because the model which change the array do not know who is currently showing that array in the GUI -- it should happen automatically thru bindings..."

To save mmalc the time of pointing to this great link...
<http://homepage.mac.com/mmalc/CocoaExamples/controllers.html>
"Programmatic modifications to arrays not noticed by table view"

- lee
 _______________________________________________
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: 
 >NSArrayController usage (From: Pierre Chatel <email@hidden>)

  • Prev by Date: RE: "Reveal Drawer" button in title bars
  • Next by Date: Re: What does "NS" means ?
  • Previous by thread: NSArrayController usage
  • Next by thread: How to get NSPersistentDocument to use a subclassed NSManagedContext?
  • Index(es):
    • Date
    • Thread