我有NSPopover
withNSBox
和 subviews 是:MKMapView
和NSImageView
. 在暗模式下,整个 NSBox 为所有子视图添加 gamma/tint。这不会出现在灯光模式下(比较下图)。它似乎与NSVisualEffectView
. 如何防止/禁用此效果?
PS:此效果在普通窗口中不显示。只有弹出框受到影响。
开箱即用的代码拖放元素。莫哈韦 10.14.4
- (IBAction)showPopover:(id)sender {
[[self popover] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSRectEdgeMaxX];
}
编辑:APR2020 根据“Adopting advanced features of the new ui of os x yosemite”(youtube),这是因为填充颜色的一些活力效果。Popover 具有有效的外观NSVibrantDarkAppearance
(lldb) po [self.view .effectiveAppearance]
▿ 1 element
- 0 : <NSCompositeAppearance: 0x60000210a940
(
"<NSVibrantDarkAppearance: 0x60000170b840>",
"<NSDarkAquaAppearance: 0x60000170ae80>",
"<NSSystemAppearance: 0x60000170afc0>"
)>
lldb) po [self.view .superview]
▿ 1 element
▿ 0 : Optional<NSView>
- some : <NSPopoverFrame: 0x1020a63f0; material: Popover; blendingMode: BehindWindow; state: Active>
所以其他可能的解决方案是使用不鲜艳的填充颜色。