Hi,
I have an NSOutlineView, and each cell within that has an NSCollectionView (a horizontal one), setup using autolayout with the 'height' of the collectionView driving the height of the OutlineView cell. Each item in the collectionView can have a dynamic width, and I use a 'dummy' collectionView to size each item from it's contents, then getting the height of the collectionView and using a 'height constraint' to make each collectionView get the height it needs (and hence the cell have a dynamic height.
It works fine for the most part, but I get this warning multiple times in the console:
"The behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.
The relevant UICollectionViewFlowLayout instance is <NSCollectionViewFlowLayout: 0x10e3b7f80>, and it is attached to <MacTagsCustomCollectionView: 0x10e3b7840>.
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger."
I've tried Googling this, but I can't find a good explanation for this issue. Also, I'm not sure why it references 'UICollectionViewFlowLayout' when it's an AppKit app and uses NSCollectionView. Also, setting the 'UICollectionViewFlowLayoutBreakForInvalidSizes' symbolic breakpoint doesn't help since it never gets triggered.
Here is some code from my outlineView's viewForTableColumn, where I get the height of the collectionView and hence the height of the cell:
Anyone with any idea on how to overcome this? I feel that it's responsible for some layout issues that I'm having in the view.
I have an NSOutlineView, and each cell within that has an NSCollectionView (a horizontal one), setup using autolayout with the 'height' of the collectionView driving the height of the OutlineView cell. Each item in the collectionView can have a dynamic width, and I use a 'dummy' collectionView to size each item from it's contents, then getting the height of the collectionView and using a 'height constraint' to make each collectionView get the height it needs (and hence the cell have a dynamic height.
It works fine for the most part, but I get this warning multiple times in the console:
"The behavior of the UICollectionViewFlowLayout is not defined because: the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values.
The relevant UICollectionViewFlowLayout instance is <NSCollectionViewFlowLayout: 0x10e3b7f80>, and it is attached to <MacTagsCustomCollectionView: 0x10e3b7840>.
Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger."
I've tried Googling this, but I can't find a good explanation for this issue. Also, I'm not sure why it references 'UICollectionViewFlowLayout' when it's an AppKit app and uses NSCollectionView. Also, setting the 'UICollectionViewFlowLayoutBreakForInvalidSizes' symbolic breakpoint doesn't help since it never gets triggered.
Here is some code from my outlineView's viewForTableColumn, where I get the height of the collectionView and hence the height of the cell:
Code Block result = [outlineView makeViewWithIdentifier:@"DataWithTags" owner:self]; if (result.tagListCollectionView.delegate == nil) { result.tagListCollectionView.delegate = self; result.tagListCollectionView.dataSource = self; result.tagsCollectionViewScrollView.automaticallyAdjustsContentInsets = NO; result.tagListCollectionView NSNib *cellNib = [[NSNib alloc] initWithNibNamed:@"MacTagsForPersonItem" bundle:nil]; [result.tagListCollectionView registerNib: cellNib forItemWithIdentifier:@"PersonTagsCollectionViewItemID"]; if (self.tagsSizingItem == nil) { NSArray *topLevelObjects; [cellNib instantiateWithOwner:self.tagsSizingItem topLevelObjects: &topLevelObjects]; for (id topLevelObject in topLevelObjects) { if ([topLevelObject isKindOfClass:[MacPersonTagsCollectionViewItem class]]) { self.tagsSizingItem = topLevelObject; break; } } } result.tagListCollectionView.backgroundColors = @[[NSColor clearColor]]; result.tagListCollectionView.enclosingScrollView.backgroundColor = [NSColor clearColor]; result.tagsCollectionViewScrollView.verticalScroller.hidden = YES; } result.tagListCollectionView.tagsPerson = person; [result.tagListCollectionView reloadData]; result.frame = outlineView.bounds; [result layoutSubtreeIfNeeded]; [result.tagListCollectionView layoutSubtreeIfNeeded]; if (person.tagsCacheHeight == 0) { person.tagsCacheHeight = result.tagListCollectionView.collectionViewLayout.collectionViewContentSize.height; } result.collectionViewHeightConstraint.constant = person.tagsCacheHeight;
Anyone with any idea on how to overcome this? I feel that it's responsible for some layout issues that I'm having in the view.