无法使用NSPopover禁用背景模糊

无法使用NSPopover禁用背景模糊

本文介绍了无法使用NSPopover禁用背景模糊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在10.10中运行时,我很难让NSPopover恢复到其10.9外观.我有一个弹出框,该弹出框附加到用户拖动的NSView上.弹出窗口必须是透明的,以便用户仍可以看到其下方其他UI元素的位置.

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.

在10.9之下一切正常,但现在在10.10之下仍具有苹果的新花哨的模糊效果,我似乎无法回到10.10的外观(除非像我一样,用户已在系统偏好设置">辅助功能"中启用了降低透明度" .我无法对最终用户实施首选项更改!).

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!).

尝试过:

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使用我选择的颜色填充背景,但是忽略了alpha值,并且弹出框是不透明的.

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

类似地,我可以使用self.popoverView.layer.backgroundColor = ...,但是在那里也忽略了alpha值!

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

推荐答案

使用:

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

这篇关于无法使用NSPopover禁用背景模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 06:09