• 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: Newbie question re: NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question re: NSArrayController


  • Subject: Re: Newbie question re: NSArrayController
  • From: mmalcolm crawford <email@hidden>
  • Date: Sun, 18 Apr 2004 23:26:17 -0700

On Apr 18, 2004, at 9:53 PM, Glenn Zelniker wrote:

Changes to the bound table need to reflect in the unbound table. When I add a row in the bound table, for example, a column needs to get added to the unbound table. I was able to do this by posting a notification from the added object's -init method, which is then observed by MyDocument which then updates the columns on the unbound table. The problem is with the delete method that comes with the NSArrayController. I want the delete action on the bound table to remove the corresponding column from the unbound table. I can't figure out how to override the array controller's methods. In fact, I can't even figure out where this object actually lives! I tried subclassing my own array controller, but for some reason IB wouldn't allow me to instantiate the class I created.

It appears that the NSArrayController uses some kind of key-value scheme to find either the -init or createObject method for the object that comprises the NSArray being controlled. The delete method seems even simpler -- it just removes the object from the array, right? But how can I actually get to the array controller and override its delete method? Am I missing something?

If you want to pursue this path:

You should be able to simply override the relevant removeObject... method(s) in an NSArrayController subclass -- see:
<http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Classes/NSArrayController.html>

You can create an instance of a subclass in IB by (after establishing the class in your nib file) first creating an instance of NSArrayController (drag from the palette) and then changing its class in the Class Inspector.

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Newbie question re: NSArrayController (From: Glenn Zelniker <email@hidden>)

  • Prev by Date: Re: Newbie question re: NSArrayController
  • Next by Date: Demarkation seen on NSScrollView,Why is it?
  • Previous by thread: Re: Newbie question re: NSArrayController
  • Next by thread: NSString's intValue method
  • Index(es):
    • Date
    • Thread