Can't disable background blur with NSPopover

陌路散爱 提交于 2019-12-20 04:24:34

问题


I'm having no luck trying to get NSPopover back to its 10.9 appearance when running in 10.10. I have a popover which is attached to an NSView that the user drags around. The popover must be transparent so the user can still see the position of the other UI elements underneath.

All works fine under 10.9 but now under 10.10 with Apple's new gimmicky blurs, I can't seem to get back to the same appearance on 10.10 (unless like me, the user has enabled "Reduce Transparency" in System Preferences > Accessibility. A preference change I can't enforce on end users!).

Have tried:

self.draggingPopover.appearance = NSPopoverAppearanceHUD;
self.popoverView.superview.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
self.popoverView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];

None of which make any difference to the popover's appearance on screen.

drawRect in my view subclass fills the background with my chosen color but ignores the alpha value and the popover is opaque.

Similarly I can use self.popoverView.layer.backgroundColor = ... but the alpha value is ignored there too!


回答1:


Use:

[popover setAppearance:(NSPopoverAppearance)[NSAppearance appearanceNamed:NSAppearanceNameAqua]];



回答2:


If a requirement is that the popover is transparent (regardless of any future design changes to popover), could you just set the popover window's (i.e. the popoverView's -window) alphaValue to some other value < 1.0?




回答3:


You can set the Aqua appearance in the storyboard as well. Select the NSPopover's content view and use this setting:



来源:https://stackoverflow.com/questions/27876645/cant-disable-background-blur-with-nspopover

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!