• 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: Core Data for managing subtree?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data for managing subtree?


  • Subject: Re: Core Data for managing subtree?
  • From: "Hamish Allan" <email@hidden>
  • Date: Tue, 15 Apr 2008 21:49:34 +0100

Ben,

Thanks for your reply.

On Sun, Apr 13, 2008 at 11:54 PM, Ben Trumbull <email@hidden> wrote:

>  If you only want only some of the tree using Core Data objects, you could
> try having an array controller manage the extra entity, and wire its content
> into your tree controller.

Could you please elaborate on "wire its content into your tree controller"?

I have an array controller in entity mode managing the objects I want
the user to be able to add and remove from the user-editable part of
the source list. So far, so good. But to get that array to appear as
the children of one the nodes of that outline view, I have tried each
of the following (in SourceListController's awakeFromNib):

1)

NSMutableDictionary *sectionNode =
  [NSMutableDictionary dictionaryWithObjectsAndKeys:
    @"SECTION", @"displayName",
    [NSNumber numberWithBool:FALSE], @"isLeaf",
    nil];
[self setUserEditableObjects:[sectionNode mutableSetValueForKey:@"children"]];
mySourceListData = [[NSArray alloc] initWithObjects:sectionNode, nil];

Then in addition to binding the array controller's Managed Object
Context, I also bind its Content Set to the userEditableObjects of the
SourceListController. (I thought this might cause duplication, but I
thought I'd try it anyway.)

2)

NSMutableDictionary *sectionNode =
  [NSMutableDictionary dictionaryWithObjectsAndKeys:
    @"SECTION", @"displayName",
    [NSNumber numberWithBool:FALSE], @"isLeaf",
    nil];
[sectionNode bind:@"children" toObject:/*(IBOutlet)*/myArrayController
  withKeyPath:@"content" options:nil];
mySourceListData = [[NSArray alloc] initWithObjects:sectionNode, nil];

(I'm not sure whether myArrayController.content makes sense in entity
mode, either.)

Both of these attempts failed silently, i.e., just failed to display
anything in my source list when I added an item through the array
controller, but without logging a complaint.

So how can I wire the array controller's content into my tree controller?

Thanks,
Hamish
_______________________________________________

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

  • Follow-Ups:
    • Re: Core Data for managing subtree?
      • From: "Hamish Allan" <email@hidden>
  • Prev by Date: Re: NSAllocateCollectable() questions
  • Next by Date: Re: [OT: security] smbclient
  • Previous by thread: re: Core Data for managing subtree?
  • Next by thread: Re: Core Data for managing subtree?
  • Index(es):
    • Date
    • Thread