Re: Another -[NSOutlineView autosaveExpandedItems] bug
Re: Another -[NSOutlineView autosaveExpandedItems] bug
- Subject: Re: Another -[NSOutlineView autosaveExpandedItems] bug
- From: Bill Cheeseman <email@hidden>
- Date: Fri, 18 Jul 2014 15:31:17 -0400
On Jul 18, 2014, at 3:12 PM, Ken Thomases <email@hidden> wrote:
> Setting aside the NSOutlineView bug you're describing, there are issues with your code:
>
> On Jul 18, 2014, at 1:19 PM, Bill Cheeseman <email@hidden> 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).
It was a lapse of attention on my part. I wrote it the right way the first time. Then, while working on another aspect of it, I glanced at this and had a flash that I needed to adjust by 1 because count is 1 more than the last index. You're right of course that NSMakeRange does want the count in the length parameter. Thanks for the catch.
I'll respond to your other suggestion shortly.
--
Bill Cheeseman - email@hidden
_______________________________________________
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