Say the button is showing and the data source changes and the collection view is reloaded...now there's a small amount of data and all can fit (after the reload), but the button still shows until I resize the window.
NSCollectionViewSectionHeaderView sectionCollapseButton doesn't autohide/show when data source changes until window is resized.
33798463
I filed a bug 1 year ago : tableView.reloadDataForRowIndexes does not update group cells
24548445
When changing the label in a group cell, a call to tableView.reloadDataForRowIndexes does not cause a redraw ; but a call to reloadData() does it.
Is there a common origin to both ?
Got requests for more info, but bug still open.
I dunno. Maybe a needsDisplay=YES would have kicked it in gear if I overrode the toggleSectionCollapse method. I didn't try though. Experimenting a bit more, it seems the collapsing behavior you get for "free" really can't be used in an app. A call to collapse a section with lots of items in it (several thousand say) causes the app to beach ball forever and ever. I lowered the number of items I tested with by a few thousand and the collapsed row didn't draw properly.
I expected items to be layed out in a collapsed section and to be reused (allowing horizontal scrolling) for the collapsed section, like Finder (since they mention FInder-like behavior in the documentation). It appears NSCollectionView just tries to stack every item in a row on top of eachother in a jumbled mess, making user interaction impossible, no scrolling at all. Not sure if anyone would use this.
Unless I'm missing some critical set up step to get this to work the way I expect...
Confirming you experiences. Getting my head arounce NSCollectionView by running through the Wenderlich tutorial. Got it all working, more or less, and then tried adding the toggleSectionCollapse and got the result that you also report. The inter item spacing is ignored and it rams ALL the section items into the collapsed view, in what I would describe as "shingle" style. Suscpiciously similar to the visual display in the Apple NSCollectionView objective C sample code from 2015 (which of course predates the toggleSectionCollapse....) Google has not been my friend in finding any working sample code. Anyone else had success ?
Additionally for anyone else that finds this, I find that the AppKit update instructions for sectionCollapse do not work properly. Updating the button text to show more/less within the toggleSectionCollapse function plays havoc ( from some debugging you are setting the text of a button that is about to be re-used when the reloadData() rebuilds the header views....) I found a more effective location is to set the text in the call that creates the header (use the section index to check if it is collapsed and set the button text accordingly).