1

I'm developing a MacOS application which uses an NSVisualEffectView (named "Rounded View" here) embedded within an application, as seen here:

Storyboard Hierarchy

The App

It is meant to provide a backdrop to an Image View. This works, but despite attempting every method I could possibly find, I cannot get this view's corners to become rounded.

What I've Tried

(Note that I've tried every combination of these things together, too.)

Setting the Mask Image

I created a transparent, high-res PNG with a black rounded square and added it as an asset, setting it in the VisualEffectView's Mask Image property:

Mask Image set in View

This has absolutely no effect on anything.

Setting wantsLayer and cornerRadius

@IBOutlet weak var roundedView: NSVisualEffectView!

...

override func viewWillAppear() {
    view.window?.isOpaque = false
    roundedView.wantsLayer = true
    roundedView.layer!.cornerRadius = 20.0
}

This has no effect either.

Various Compositing Filters

I figured maybe setting a special blend mode would help. None of them force my intended tweaks to opacity to take effect.

Ethan McTague
  • 2,236
  • 3
  • 21
  • 53
  • try adding `roundedView.layer!.masksToBounds = true` to your viewWillAppear func. – inexcitus Sep 04 '19 at 09:33
  • @inexcitus It made no difference, unfortunately. I've noticed that there's also a `maskedCorners` property, though.. but it doesn't seem to do anything either if I set it to all four corners – Ethan McTague Sep 04 '19 at 14:01

0 Answers0