Setting aside the NSOutlineView bug you're describing, there are issues with 
your code:

On Jul 18, 2014, at 1:19 PM, Bill Cheeseman <wjcheese...@gmail.com> wrote:

> - (IBAction)expandAllRows:(id)sender {
>    AWRSourceListOutlineView *outlineView = [self sourceListOutlineView];
>    NSIndexSet *topLevelItemIndexes = [NSIndexSet 
> indexSetWithIndexesInRange:NSMakeRange(0, [[self sourceListContents] count] - 
> 1)];

This leaves out the index of the last item.  A range consists of a starting 
index and a length, _not_ the last index.  Count - 1 would be appropriate for a 
last index, but not for a length of a range that encompasses the last index 
(assuming starting at 0).

>    [topLevelItemIndexes enumerateIndexesWithOptions:NSEnumerationReverse 
> usingBlock:^(NSUInteger itemIndex, BOOL *stop) {
>        [outlineView expandItem:[[self sourceListContents] 
> objectAtIndex:itemIndex] expandChildren:YES];
>    }];

Is there a reason you didn't just directly enumerate the objects in the 
collection?  Constructing an index set for all of the items, enumerating that, 
and then looking up the items by the index seems cumbersome.

    [[self sourceListContents] enumerateObjectsWithOptions:NSEnumerationReverse 
usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [outlineView expandItem:obj expandChildren:YES];
    }];

Even if I've misunderstood and you're deliberately skipping the last element, 
it's probably cleaner to do that with the above with an added check on the idx 
parameter.

Regards,
Ken


_______________________________________________

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