NSTreeController -removeObjectsAtArrangedObjectIndexPath:
NSTreeController -removeObjectsAtArrangedObjectIndexPath:
- Subject: NSTreeController -removeObjectsAtArrangedObjectIndexPath:
- From: Ben Lachman <email@hidden>
- Date: Mon, 8 Oct 2007 00:46:41 -0400
Has any one else had issues with this method? I have an outline view
fed by a tree controller. When a root level item is deleted I'd like
to delete the child items as well (or any parent item for that
matter). My first try was to simply call
[outlineViewContentController
removeObjectsAtArrangedObjectIndexPaths:paths]; where paths is an
array of index paths to valid items including both the parent item
and all descendant items. When I do that I get an exception on
NSArray -addObject: saying that I am adding a nil object. Somewhat
confusing seeing as I'm removing objects, but we'll chalk that up to
the oddness of NSOutlineView/NSTreeController. So I decide to take
this apart and delete each level of items in reverse order... leaf
nodes first, root nodes last. 40 lines of code later it works. But
Cocoa shouldn't be this way and I'd like a better way. Does anyone
know why -removeObjectsAtArrangedObjectIndexPath: doesn't work with
multiple levels of item index paths? Is there a less complex work
around than going through the paths, and sorting them by length
(depth) and processing them in batches?
Thanks,
->Ben
_______________________________________________
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