Hi,

I’m trying to clear all the Items from a Tree View apart from the Root Item.

When my View gets initialized, it creates a Section called: “OBJECTS”, this is 
the Item that has the Show/Hide in Title. 

Then when I get a Notification, I add items to the Tree Controller, this works 
fine.

The “OBJECTS” Section, has an Index Path of: Index=0 Length=1.

The first Item I add (“Object-A:) to the “OBJECTS” section, is a Top Level 
container for a Hierarchy of  Objects (hence using a Tree Controller to display 
it), this has an Index Path of Index:0.0 Length=2. It then adds all the child 
objects inside it, Index Paths, 0.0.0, 0.0.1, 0.0.2, etc.

There may be more than one object in the “OBJECTS" section, e.g. Object-B has 
Index Path 0.1. 

I get small changes to the Hierarchy from time to time and also updates to the 
Data in the Leaf Nodes. This all work wonderfully.

There are two notifications that I have yet to handle: “Clear All” and 
“Replace”. In order to handle these I need to clear all the Items from the 
“Objects” section.

I tried doing this:

myIndexPath = [self newIndexPathWithObjectIndex:0];
[self.pTreeController removeObjectAtArrangedObjectIndexPath: myIndexPath];

myIndexPath is set to 0.0, length 2. But this removes the “OBJECTS” section too 
(at Index Path 0 Length 1).

If I don’t clear the Section, then I end up for duplicates.

So, finally, my question is how do I remove everything inside the “OBJECTS” 
Section?

Thanks a lot for any help.
Cheers
Dave


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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

This email sent to arch...@mail-archive.com

Reply via email to