• 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
NSTreeController -removeObjectsAtArrangedObjectIndexPath:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSTreeController -removeObjectsAtArrangedObjectIndexPath:
      • From: Chris Williams <email@hidden>
  • Prev by Date: Re: swapping textfields and the transparency problem - resolved
  • Next by Date: Re: nsarraycontroller and nsuserdefaultscontroller
  • Previous by thread: Re: Using NSScrollView with self clipping views?
  • Next by thread: Re: NSTreeController -removeObjectsAtArrangedObjectIndexPath:
  • Index(es):
    • Date
    • Thread