views:

86

answers:

1

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
But how would I make it so that you can have child objects in the group and it could be collapsed?
Joshua
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
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
How can a give it a parent entity?
Joshua
I can't set the Outline view a value only the columns can I add a value.
Joshua
How would you make the Outline View link to an entity?
Joshua
Ok, I've created a NSTreeController But how do I make that make the table display all the entity's?
Joshua
Ok, I've created a NSTreeController But how do I make that make the table display all the entity's?
Joshua