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

Re: NSArrayController help


  • Subject: Re: NSArrayController help
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 2 Nov 2003 16:11:52 -0500

On Oct 31, 2003, at 3:06 PM, Mike Nowak wrote:

I am exploring using NSArrayController to help me manage a table in my interface. I have an object that represents annual data. My table displays the year as the first item in the table. When a person adds a new item to my array, I wanted to find the maximum year that exists and prefill in that year + 1 by initializing the year instance variable for that object.

I am finding it tricky to find a hook to do this. I thought I could an add an observer to the mutable array but I'm not sure how to do that or how to get to the mutable array the NSArrayController is managing anyway. It would be nice if there was some kind of delegate method in NSArrayController that would let me know when its about to add an item, or about to remove an item, and so on. But I didn't see any delegate methods.

I guess I can subclass NSArrayController and so I can override addObject and set the year for the new item. Is the best way to do it? Thanks!


Another option would be to register as an observer of the contents of the array, and when an insertion takes place, you could then modify the object(s).
_______________________________________________
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.
  • Follow-Ups:
    • Re: NSArrayController help
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Controller Layer, Bindings...
  • Next by Date: NSSplitView: NSView: NSOpenGLView
  • Previous by thread: Re: NSArrayController help
  • Next by thread: Re: NSArrayController help
  • Index(es):
    • Date
    • Thread