• 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
Re: Another -[NSOutlineView autosaveExpandedItems] bug
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another -[NSOutlineView autosaveExpandedItems] bug


  • Subject: Re: Another -[NSOutlineView autosaveExpandedItems] bug
  • From: Bill Cheeseman <email@hidden>
  • Date: Fri, 18 Jul 2014 15:52:39 -0400

On Jul 18, 2014, at 3:12 PM, Ken Thomases <email@hidden> wrote:

> 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];
>    }];


Another lapse of attention on my part. I had been writing a similar method to enumerate selected rows, where using NSIndexSet is appropriate. I just grabbed the same code and stuck it in here. It worked, of course, but you're right that it was cumbersome. In addition, I don't need the NSEnumerationReverse option when enumerating items in the datasource instead of rows. Here's my final code:

- (IBAction)expandAllRows:(id)sender {
    AWRSourceListOutlineView *outlineView = [self sourceListOutlineView];
    NSArray *topLevelItems = [self sourceListContents];
    [topLevelItems enumerateObjectsUsingBlock:^(id obj, NSUInteger itemIndex, BOOL *stop) {
        [outlineView expandItem:obj expandChildren:YES];
    }];
}

Thanks again. I don't know what I would do without you!

--

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


References: 
 >Another -[NSOutlineView autosaveExpandedItems] bug (From: Bill Cheeseman <email@hidden>)
 >Re: Another -[NSOutlineView autosaveExpandedItems] bug (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Another -[NSOutlineView autosaveExpandedItems] bug
  • Next by Date: Is it wrong to create relationships in -createDestinationInstancesForSourceInstance:…?
  • Previous by thread: Re: Another -[NSOutlineView autosaveExpandedItems] bug
  • Next by thread: Is it wrong to create relationships in -createDestinationInstancesForSourceInstance:…?
  • Index(es):
    • Date
    • Thread