nsvisualeffectview

NSVisualEffectView with rounded corners

£可爱£侵袭症+ 提交于 2021-02-20 18:56:04
问题 How display a NSVisualEffectView with with rounded corners in OS X? My code to add my NSVisualEffectView: let visualEffectView = NSVisualEffectView(frame: NSMakeRect(0, 0, 300, 300)) visualEffectView.material = NSVisualEffectMaterial.Dark visualEffectView.blendingMode = NSVisualEffectBlendingMode.BehindWindow self.addSubview(visualEffectView) 回答1: You can enable layer backed views for your NSVisualEffectView by setting wantsLayer to true and then set the cornerRadius of the backing layer: let

NSVisualEffectView with rounded corners

情到浓时终转凉″ 提交于 2021-02-20 18:55:07
问题 How display a NSVisualEffectView with with rounded corners in OS X? My code to add my NSVisualEffectView: let visualEffectView = NSVisualEffectView(frame: NSMakeRect(0, 0, 300, 300)) visualEffectView.material = NSVisualEffectMaterial.Dark visualEffectView.blendingMode = NSVisualEffectBlendingMode.BehindWindow self.addSubview(visualEffectView) 回答1: You can enable layer backed views for your NSVisualEffectView by setting wantsLayer to true and then set the cornerRadius of the backing layer: let

Make Title Bar and View Controller seamless with Dark Transparency

时间秒杀一切 提交于 2020-04-06 03:37:33
问题 Hi so iv been looking all over the internet and have found all kinds of useful information on this topic but none seems to be working if trying to get something like this where the title bar and the rest of the window blend. From the internet the code iv got so far is in my viewDidLoad() self.view.window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark) self.view.window?.styleMask = (self.view.window?.styleMask)! | NSFullSizeContentViewWindowMask self.view.window?

How to get the source lists selection highlight to use the Dark Vibrancy appearance in OS X 10.10?

回眸只為那壹抹淺笑 提交于 2019-12-30 00:37:47
问题 In OS X 10.10 source lists seem to use the light vibrancy appearance. In the Finder (and in some other third party applications, Things.app for example) the selected item in the source list is indicated by a dark vibrancy appearance. For example, see the Desktop row in the image below. How can I replicate this behaviour? Do I need to use the delegate methods to specify the table row view, -outlineView:rowViewForItem: and attempt custom drawing myself or is there a more straight forward

NSImageView on NSVisualEffectView

牧云@^-^@ 提交于 2019-12-13 07:25:19
问题 I need to make NSMenuItem with icon at the right side. I ended up with custom view which contains NSTextField and NSImageView on top of NSVisualEffectView with selection material, that I use to imitate system selection. NSVisualEffectView is hidden by default. But when the item is selected, my NSVisualEffectView appears on screen and image is drawn with background. How can I get rid of it? wantsLayer = YES and backgroundColor = CGColor.clear did not help. Thanks in advance. 回答1: You don't

NSButton on NSVisualEffectView: Wrong Background Color

最后都变了- 提交于 2019-12-12 07:37:32
问题 I have a NSVisualEffectView within a NSPopover developed for 10.10 . When subclassing the NSVisualEffectView to have hover background color effect, the borderless button color seems to be different I tried setting the backgroundColor of the button cell to clearColor or the same as I used in drawRect: in of the NSVisualEffectView , the former gives wrong color (not filled with blue) and the later still the same with wrong color. (gray box around its border). CALayer can fix this but is there a

How to add buttons when NSVisualEffectView is used

帅比萌擦擦* 提交于 2019-12-07 14:41:20
问题 I have created a window using NSVisualEffectView to get blur and rounded corners. Like here The problem is I don't see my button in the window when I have NSVisualEffectView code. If I remove the code, the button is displayed. What is going wrong? NSVisualEffectView code in AppDelegate.swift: func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application guard let window = NSApplication.shared().windows.first else { return } let effect =

How to add buttons when NSVisualEffectView is used

蹲街弑〆低调 提交于 2019-12-05 20:07:01
I have created a window using NSVisualEffectView to get blur and rounded corners. Like here The problem is I don't see my button in the window when I have NSVisualEffectView code. If I remove the code, the button is displayed. What is going wrong? NSVisualEffectView code in AppDelegate.swift: func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application guard let window = NSApplication.shared().windows.first else { return } let effect = NSVisualEffectView(frame: NSRect(x: 0, y: 0, width: 0, height: 0)) effect.blendingMode = .behindWindow

How to use NSVisualEffectView backwards-compatible with OSX < 10.10?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 19:29:00
The upcoming OSX 10.10 ("Yosemite") offers a new type of view, NSVisualEffectView, which supports through-the-window or within-the-window translucency. I'm mostly interested in through-the-window translucency, so I'm going to focus on that in this question, but it applies to within-the-window translucency as well. Using through-the-window translucency in 10.10 is trivial. You just place an NSVisualEffectView somewhere in your view hierarchy and set it's blendingMode to NSVisualEffectBlendingModeBehindWindow . That's all it takes. Under 10.10 you can define NSVisualEffectView s in IB, set their

Disable NSVisualEffectView in Source List NSTableView

一笑奈何 提交于 2019-12-01 05:01:31
问题 I have an older application that has a specific appearance based on NSCell-based NSTableView having Source List highlighting. Unfortunately, on Yosemite this adds the NSVisualEffectView vibrancy under the selected cell which breaks the appearance in an unpleasant way. I can't find a way to opt-out of this behaviour, unfortunately. Setting Regular highlighting breaks the appearance in another way (grey selection instead of blue). Any idea if there is a way to opt-out of this behaviour on 10.10