UIVisualEffectView glitches

63 Views Asked by At

I'm trying to create a super thin UIVisualEffectView (2 pixels tall) with a blur effect. I'm attaching it to the bottom of a collection view cell. The issue on scrolling the effect view flickers between a black color and the blur (sometimes it will remain black when I stop scrolling). When I increase the height to 3 pixels, it behaves normally.

Is there a limitation on how small I can make a UIVisualEffectView before it behaves unpredictably? If so, is there a workaround?

1

There are 1 best solutions below

0
DonMag On

Based on the OP's comment...

UIVisualEffectView with blur effect uses adjacent pixels to generate the blur ... using a very small (in this case, 2-points-tall) view apparently causes the issue.

To avoid that, use a slightly larger UIVisualEffectView and mask it to the desired 2-points height.