• 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: Creating Subclass in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating Subclass in Core Data


  • Subject: Re: Creating Subclass in Core Data
  • From: Volker in Lists <email@hidden>
  • Date: Sun, 22 Feb 2009 20:38:25 +0100

Hi Paul,

I recommend not use the add: / addChild: methods of the TreeController, but create yur own methods for that. In each instantiate an object of the entitytype you want as parent/child. See http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html#/ /apple_ref/doc/uid/TP40001654 for how to create objects in code. Set the proper parent objects , that is nil for "parents" and the parent entity for the children.

I have the same solution in a couple of apps with exactly the same structure and needs as I gather you have.

Cheers,
Volker

Am 22.02.2009 um 20:19 schrieb Paul Franz:

I have a simple class hierarchy defined in Model for the Core Data Entity:

Class: AbstractClass (Abstract Class is checked as abstract
Parent Class: None
Attributes:
  Name
  Children

Class: Class1
Parent Class: AbstractClass
Attributes: None

Class: Class2
Parent Class: AbstractClass
Attributes:
  Description
  Cost

How do I create a subclass of Class1 or Class2 instead of the abstract class AbstractClass?

I have created a NSTreeController in IB. The Attributes tab for the NSTreeController, the Key Paths (Children) is set to "Children" and Object Controller (Mode) is set to "Entity" with the Entity Name is set to "AbtractClass". I have a NSOutlineView which is bound to this NSTreeController. And a "New" button to create a new entity is bound to the "add" method of the NSTreeController and a "New Child" button to create a new child is bound to the "addChild" method of the NSTreeController. It seems to work. But I have no idea what types of entities are being created. My assumption is that they are of type "AbstractClass".

Paul Franz
_______________________________________________

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

_______________________________________________

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


References: 
 >Creating Subclass in Core Data (From: Paul Franz <email@hidden>)

  • Prev by Date: Creating Subclass in Core Data
  • Next by Date: iPhone MPMoviePlayerController stops iPod
  • Previous by thread: Creating Subclass in Core Data
  • Next by thread: iPhone MPMoviePlayerController stops iPod
  • Index(es):
    • Date
    • Thread