Removing all objects in NSTreeController
Removing all objects in NSTreeController
- Subject: Removing all objects in NSTreeController
- From: Andrew Merenbach <email@hidden>
- Date: Sat, 24 Jun 2006 16:31:13 -0700
I'm trying to remove the entire contents of an NSTreeController, but
the following fails to work:
- (void)removeAll:(id)sender {
NSMutableArray *ips = [[NSMutableArray alloc] init];
unsigned idx = [[self content] count];
NSIndexPath *ip;
while (idx--) {
ip = [[NSIndexPath alloc] initWithIndex:idx];
[ips addObject:ip];
[ip release];
}
[self removeObjectsAtArrangedObjectIndexPaths:ips];
[ips release];
}
Clearing the selection beforehand fails to help things, either. When
the tree controller has multiple objects I end up with an the
following error:
*** -[NSCFArray addObject:]: attempt to insert nil
I'm removing, not inserting, so I've no idea what's going on here.
I'm also positive that I'm generating my selection indices correctly
because using addSelectionIndexPaths: instead of
removeObjectsAtArrangedIndexPaths: selects everything the way that
one would expect.
Does anyone have an idea of what's going on with
removeObjectsAtArrangedObjectIndexPaths: that the documentation that
I've found doesn't seem to cover?
Also, and perhaps more importantly, is there a better way to "clear"
an NSTreeController?
Many thanks,
Andrew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden