I am Developing A Core Data App, and would like to add a feature like the Groups feature in iChat to my App. The Feature would be displayed in the table with normal table rows and more groups could be created. Other rows of the table could be dragged into the Group and the Group could be collapsed and opened. What code would I need to do this and Is it possible?
+3
A:
Check out NSOutlineView. Basically, what you're going to want is two different Core Data entities: Group
and Child
. Group
would have a to-many relationship, children
, to Child
objects, and Child
would have a to-one relationship, parent
, to one Group
entity.
That's enough to get the basic model defined. Past that, you need to break your question down more. For example, how do I implement drag & drop using Core Data? That's been answered many times. How do I mix two different entity types in a single outline view? Also answered before. Break the question down into each individual sub-task and look for an answer – I'd bet most of them of them have an answer on Stack Overflow.
Matt Ball
2009-05-12 08:42:04
But how would I make it so that you can have child objects in the group and it could be collapsed?
Joshua
2009-05-12 15:02:41
I also searched for the question 'How do I mix two different entity types in a single outline view?' and similar words but it found no results.
Joshua
2009-05-12 15:04:44
The usual way to mix object types in an outline view (which I assume is bound to an NSTreeController) is to make both the Group and Child entities share a common parent entity type (say, "OutlineItem") and set the tree controller's entity type to OutlineItem so that both entity types can coexist.
Matt Ball
2009-05-12 22:33:33
How can a give it a parent entity?
Joshua
2009-05-13 05:47:29
I can't set the Outline view a value only the columns can I add a value.
Joshua
2009-05-13 15:25:41
How would you make the Outline View link to an entity?
Joshua
2009-05-13 15:27:10
Ok, I've created a NSTreeController But how do I make that make the table display all the entity's?
Joshua
2009-05-13 15:59:01
Ok, I've created a NSTreeController But how do I make that make the table display all the entity's?
Joshua
2009-05-14 15:05:18