NSScrollView/NSCollectionView on NSVisualEffectView cause flickering

995 Views Asked by At

I have a NSCollectionView within a NSVisualEffectView within a NSPopover. Everytime when it's refreshing(add, remove, reload NSCollectionViewItem, or even just click buttons on the NSCollectionViewItem's view), it has glitches on the controls.

Here's a screenshot I try to get when it's opening:

Flickering

It's more or less like this but only when the redrawing happens:

enter image description here

Also, if I put a button with border off on it, when clicked the color went off, just like the flickering:

enter image description here

I tried to set background color in different views/controls, but seems the NSCollectionView will always be black/white (depending on UI color selection) when it's empty:

enter image description here

Did I missed anything?

EDIT:

By adding scrollView.needsDisplay = false/true before/after the item change will make some of the flickers gone. Still, most the problems still exist.

Also, if I forcely enabled horizontal scroller bar or disabled autoresize subview, the flicker will no longer show when add/remove items.

2

There are 2 best solutions below

0
On BEST ANSWER

Ok, seems disabling the "Autoresize Subviews" on the problematic view will do the trick.

1
On

I had the same problem using a NSTableView inside a NSPopover. I was able to fix it by setting all the controls to the appearance type Aqua instead of dark/light.