Re: Core Data with NSArrayController Confusion
Re: Core Data with NSArrayController Confusion
- Subject: Re: Core Data with NSArrayController Confusion
- From: "I. Savant" <email@hidden>
- Date: Tue, 8 Apr 2008 13:20:53 -0400
> Adding a cell, in addition to creating a new Cell entity, also has to do
> some custom tasks on initialization. Each cell has a one-to-one
> relationship with another managed object (Scene), so the scene object needs
> to be created and inserted in to the MOM when the cell is created.
This is 'business logic' that belongs in your model. Subclass
NSManagedObject for your Cell entity (remember to set the entity to
use the custom subclass in your data model) and put the
"create-my-dependent-object(s)-and-establish-relationships" logic
inside the -awakeFromInsert method.
> Also, the starting location of the cell in the CellMapView is determined by
> fetching all existing cells in the context and figuring out the first spot
> that is not occupied by a previously created cell.
Same as above; determine this in -awakeFromInsert and configure as necessary.
> What gives? Is overriding "newObject" not the way to go in my situation?
For this? Emphatically: NO.
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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