Hi Rob,

On 5/11/09, Rob Keniger wrote:

as I add a new item to the top level it fails because the tree controller does not assign the "invisible" root item as the parent of the new item.

Fritz's idea looks much cooler (I might try it) but for a clumsier solution, have you written your own method to add new top-level items? I wonder if an IBAction like this would work:

- (IBAction)
addVisibleTopLevelItem: sender
{
    YourEntity *invisibleTop = [self topObject];
    YourEntity *newVisibleTop =
    [NSEntityDescription insertNewObjectForEntityForName: @"YourEntity"
                                  inManagedObjectContext: [context]];
[newVisibleTop setParent: invisibleTop]; // does your entity have a setParent?
    // might also need to add a child to inVisibleTop
    [treeController addObject: newVisibleTop];
    [treeController rearrangeObjects];          // needed?
}

Something along similar lines seems to work for me.

Cheers,

Steve

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to