NSView 在 10.12 不显示 shadow 问题详解 2017 年 12 月 21 日 Posted by R0uter Mac OS Swift 在 iOS 上,如果我们要一个 View 显示阴影,那么基本上是这么做的: 12345 self.view.layer?.shadowColor = NSColor.black.cgColor self.view.layer?.shadowOpacity = 0.1 self.view.layer?.shadowOffset = CGSize(width: 0, height: 0) self.view.layer?.shadowRadius = 3 self.view.layer?.masksToBounds = false 不过,到了 macOS 上,这样就不灵了——没有任何效果。 答案在于 macOS 上如果你想要给一个 View 使用 [crayon-68bb058[……] 点击跳转以继续阅读