• 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: Best way to set default values for "added" objects bound to NSArrayController?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to set default values for "added" objects bound to NSArrayController?


  • Subject: Re: Best way to set default values for "added" objects bound to NSArrayController?
  • From: Shawn Erickson <email@hidden>
  • Date: Sun, 30 Jan 2005 07:51:18 -0800


On Jan 30, 2005, at 7:05 AM, Mark Munz wrote:

Is subclassing NSArrayController and overriding addObject: the best way to setup default values for newly created object (NSMutableDictionary) or is there a way to do that without subclassing?

First note that NSArrayController is a sub-class of NSObjectController and that class supports automatic initialization.


Automatic when enabled (setAutomaticallyPreparesContent:YES or in bindings panel) will call the controllers newObject method which causes the object to be created and the standard init method to be called. So if the object type you are adding to the array can set its defaults in its own init method then you should likely use this method.

Otherwise I believe you sub-class NSArrayController and override either prepareContent and newObject or both depending on what you need to do. I think that is better then attempting to override addObject:.

-Shawn

_______________________________________________
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


  • Follow-Ups:
    • Re: Best way to set default values for "added" objects bound to NSArrayController?
      • From: Mark Munz <email@hidden>
References: 
 >Best way to set default values for "added" objects bound to NSArrayController? (From: Mark Munz <email@hidden>)

  • Prev by Date: (OT) Helper tool crashing under 10.2.8
  • Next by Date: Re: Best way to set default values for "added" objects bound to NSArrayController?
  • Previous by thread: Best way to set default values for "added" objects bound to NSArrayController?
  • Next by thread: Re: Best way to set default values for "added" objects bound to NSArrayController?
  • Index(es):
    • Date
    • Thread